Creation Management Registry Flashcards
What is the use of a Dockerfile
to create an image
What does the RUN command do
runs command on container at build time in a new layer
What is the purpose of the CMD instruction in the docker file
it is the default command that is started when a container is run
What is the purpose of LABEL?
adds metadata
What is the difference between ADD and COPY
COPY takes in a src and destination. It only lets you copy in a local file or directory from your host
ADD lets you do that too, but it also supports 2 other sources. First, you can use a URL instead of a local file / directory. Secondly, you can extract a tar file from the source directly into the destination.
Identify and display the main parts of a Dockerfile.
FROM creates a layer from the given image
COPY copies src into container
RUN runs a command in the container
CMD specifies what command to run within the container
Pull an image
docker image pull IMAGE
List images
docker image ls
docker image ls -a
Remove an image
docker image rm IMAGE
docker image rm -f IMAGE
What does docker image prune do
removes “dangling” images (images that have no relationship to tagged images)
How to inspect an image
docker image inspect IMAGE
docker image inspect IMAGE –format {{go template}}
How do you tag an image
Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Apply a file to create a Docker image.
docker image build
How to display layers of a Docker image
docker image history
How to modify an image to a single layer.
docker export flat_container > flat.tar
cat flat.tar | docker import - flat:latest