Debugging a Docker image can take a lot of time. Writing unit test can save it and can reduce the fear of rebuilding and updating a container. [Here](https://www.gasparevitta.com/posts/docker-unit-test-dockerfile-image/) I try to explain how this can be done using a framework developed by Google: Container Structure Test.
Someone posted this recently, I have tried it yet, but looks cool. (Early days for this tool)
https://github.com/wagoodman/dive
You can also use the “xray” and “lint” commands in docker-slim. Linting is still WIP, but it already has a number of good checks.