docker container

docker container ls -a (displays all containers including those stopped, exited) (Question – can we restart a container?) (Question – can we delete an image and still container be running?)

docker rm ==> will remove the container.

Image Vs Container

This link is good. An image is an inert, immutable, file that’s essentially a snapshot of a container. Images are created with the build command, and they’ll produce a container when started with run. Images are stored in a Docker registry such as registry.hub.docker.com. Because they can become quite large, images are designed to be composed of layers of other images, allowing a miminal amount of data to be sent when transferring images over the network.

‘docker history’ is your friend

docker history command is your friend. It gives complete history of all the layers an image is built on including the size of each layer.

docker inspect is second best friend

docker inspect is awesome! It gives everything you need to know for a container.

docker commit

This is another cool command. It makes a new docker image from running container. Take it to new machine and start running; or use it for debugging, Use the image to start container with additional options.