Docker Images Flashcards
What do docker images consist of?
Layers of files containing the differences between each layer
What is the writable container layer?
Changes the container makes to its file system go into the top writable container layer, containing changes from the base layers
How do you get an image?
docker image pull
How do you view the layers within an image?
docker image history
How do you build an image?
With a Dockerfile
docker build -t .
Explain the following Dockerfile directives: FROM, ENV, RUN, CMD
FROM - starts build setting by base image
ENV - sets environment variables visible to file itself and container at runtime
RUN - creates layer on previous layer and commits changes
CMD - specify default command to run a container runtime
Explain the following Dockerfile directives: EXPOSE, WORKDIR, COPY, ADD
EXPOSE - documents which ports intended to be published
WORKDIR - sets the current working directory for subsequent directives
COPY - copy files from local machine to image
ADD - copy, can also pull files from url
Explain the following Dockerfile directives: STOPSIGNAL, HEALTHCHECK
STOPSIGNAL - specify the signal that will be used to stop the container
HEALTHCHECK - specify a custom health check to verify the container is working properly