How to check if the docker image has all the files?

sharman picture sharman · Jun 23, 2017 · Viewed 9.1k times · Source

Is there a way to check if the docker image has all of the files that the Dockerfile copies over and to understand if the image is built as configured in the Dockerfile? My situation is that the image is built successfully, however when I try running it, docker complains that it cant find some file or other and the container fails to run, so I cant exec on it.

Doing docker inspect is not helping since it does not report on the files in the image. Is there some method?

Answer

Robert picture Robert · Jun 24, 2017

You can run a shell based on that image:

docker run -it <image-name> bash

Use sh instead if there is no bash available. There you can search for files as any shell.

But maybe you have not bash in the image, so use sh:

docker run -it <image-name> sh

But maybe you have an odd entrypoint, so override it:

docker run -it --entrypoint sh <image-name>