Docker Flashcards
What is a Docker Image?
A Docker Image is a file which contains all the necessary dependency and configurations which are required to run an application.
What is a Docker Container?
A Docker Container is essentially a running instance of an image.
Are Docker containers created with a UUID?
Yes, when the container is created a UUID is created. The UUID can be used to help identify the container.
What happens when you do not specify a name for a container?
Docker will supply a randomly generated name from two words joined together by an underscore
How do you add a name to a Docker container?
You can add –name to your command
What does the number to the left a port mapping signify?
The port that the host machine is listening on
What does the number to the right a port mapping signify?
The port that the container is listening on
What is the benefit of running a container in the foreground mode?
You will be able to all of the output from the container
Is foreground or detached mode default for a container?
Foreground is default for a container
What command lists all running containers?
docker ps
What command lists all containers running or otherwise?
docker ps -a
How do you stop a container by name?
docker container stop <image_name></image_name>
How do you list all containers within the environment?
docker container ls -aq
How would you stop all containers with one command?
docker container stop $(docker container ls -aq)
How would you remove a container?
docker container rm <image_name></image_name>