Monday, July 8, 2019

Docker inspect image content tricks

Sometimes one might wonder what exactly the image looks like once run as a container. This is particularly useful for debugging. 

Docker run command help us solve this problem. 

docker run -it --rm to do two things, first, automatically use the current terminal to connect to the container, and then when the container finishes, remove it.  Now we change the entry point to use bash (or cmd.exe for windows containers).

c:\Docker>docker run -it --rm --entrypoint "bash" reposit:v4
root@35b518b7b518:/home/reposit# ls
data  node_modules  package-lock.json  package.json  repositConnector.js
root@35b518b7b518:/home/reposit#