Docker Flashcards
What is the command to output the version of the installed Client and Server?
docker version
What is the command to list the images that have been downloaded to the machine?
docker image ls
docker images
What is the command to output detailed information about the docker installation?
docker info
What is the command to list the running containers?
docker ps
What is the command to list all containers on the system?
docker ps -a
What is the command to show the last running container?
docker ps -al
What is the command to run an image?
docker run [IMAGE]
What switch should be used with the docker run
command to delete the container immediately after it exits?
-rm
Full command: docker run -rm [IMAGE]
What switch should be used with the docker run
command to run the container in interactive mode?
-ti
Full command: docker run -ti [IMAGE] [PROCESS]
Example: docker run -ti ubuntu bash
What switch should be used with the docker run
command to run the container detached in the background?
-d
Full command: docker run -d [IMAGE] [PROCESS]
What switch should be used with the docker run
command to give the container a custom name?
–name [NAME]
What switch should be used with the docker run
command to forward a port out of the container?
-p [CONTAINER PORT]:[LOCAL PORT]
What is the command to stop a running container?
docker stop [CONTAINER NAME]
What is the command to remove a stopped container?
docker rm [CONTAINER NAME]
What is the command to view the logs of a running container?
docker logs [CONTAINER NAME]