Docker Basics Flashcards
Command to get docker version
docker –version
What is docker hub
- Docker hub is a public docker registry at hub.docker.com
- anyone can access these images
route to find docker image registries in docker hub
- http://hub.docker/r/{ imagename }
- registries hold repositories.
- repository:version
How to specify the port in a docker run
- docker run -p { port1 }:{ port2 }
- docker run -p { 5000 }:{ 5000 }
- -p is short for publish.
What is it called when an image is running?
a container
What is the bridge network
Internal docker network. All containers run inside the bridge network. You cannot access the container unless the container is exposed to the outside.
What is the first port and second port of a specified docker container. EX: 5000:5000
The first port number is a host port and the second is the container port
How to launch docker container detached from the command line
add a { -d } to the docker run command
command to print out logs
docker logs { container id/name }
how to follow the logs of a docker container
-f
exL docker logs -f { container id/name }
How to list out images created
docker images
how to list all the running containers
docker container ls
how to follow the logs of a docker container
-f
ex: docker logs -f { container id/name }
what option allows you to list out all the docker containers. Even the ones that have been exited
-a
docker container ls -a
What is the docker Client?
Docker client takes our commands and sends them to the docker daemon.
- It pulls images
- Manages your containers
- pushes images to the repository
What is the docker daemon
Docker daemon is the server side. Docker is a client server architecture
How to download an image to local storage
pull
docker pull {image}
How to see the layers of a docker image
history
docker image history { image }
How to find specs/metadata about the docker image
inspect
docker image inspect { image }
how to remove an image
remove or rm
docker image rm { image_name }
How to pause a container
pause
docker container pause { image_name }
How to restart a paused docker container
docker container unpause { image_name }
What is the difference from docker container stop and kill?
Docker container stop gracefully closes the processes that are running.
docker container kill sends the command sig kill. This drops everything and terminates it right away. Is not graceful
Get details about a container
inspect
docker container inspect { id/name }