More on this book
Community
Kindle Notes & Highlights
A Dockerfile is a plain-text document describing how to build an app into a Docker image.
Tomas Veres liked this
Use the docker image build command to create a new image using the instructions in the Dockerfile.
Images are made up of multiple layers that get stacked on top of each other and represented as a single object.
The process of getting images onto a Docker host is called pulling.
Docker images are stored in image registries. The most common registry is Docker Hub (https://hub.docker.com).
Image registries contain multiple image repositories. In turn, image repositories can contain multiple images.
Just because an image is tagged as latest does not guarantee it is the most recent image in a repository!
If you want to pull images from 3rd party registries (not Docker Hub), you need to prepend the repository name with the DNS name of the registry.
A dangling image is an image that is no longer tagged, and appears in listings as <none>:<none>.
The image itself is really just a configuration object that lists the layers and some metadata.
The layers are where the data lives (files etc.).
A handy shortcut for deleting all images on a Docker host is to run the docker image rm command and pass it a list of all image IDs on the system by calling docker image ls with the -q flag.
A container is the runtime instance of an image.
The -it flags will connect your current terminal window to the container’s shell.
Containers run until the app they are executing exits.
The simplest way to start a container is with the docker container run command.
a container cannot exist without a running process
port mappings are expressed as host-port:container-port.
Do not underestimate the impact of the Dockerfile as a from of documentation! It has the ability to help bridge the gap between development and operations!
You can use the docker image inspect web:latest command to verify the configuration of the image.
The basic premise is this - if an instruction is adding content such as files and programs to the image, it will create a new layer. If it is adding instructions on how to build the image and run the application, it will create metadata.
Multi-stage builds were new with Docker 17.05 and are an excellent feature for building small production-worthy images.
docker image build is the command that reads a Dockerfile and containerizes an application.
docker-compose up is the most common way to bring up a Compose app (we’re calling a multi-container app defined in a Compose file a Compose app). It builds all required images, creates all required networks and volumes, and starts all required containers.