Introduction/Overview
This lesson takes a deeper dive into Docker commands, especially docker image
and docker container
.
The docker
command
In this 3-minute video, Tom Hicks describes the docker
command: docker
, docker help
, docker pull
, and docker run
.
Demonstration: Pull and Run a Docker container
In this 8-minute video, Tom demonstrates pulling a Docker image and running the corresponding Docker container.
The docker image
subcommand
In this 9-minute video, Tom describes the docker image
subcommand and Docker image identifiers (e.g., IMAGE ID):
docker image
show the docker image command optionsdocker image ls
list the docker images in your local repository:
Sometimes Docker will complain about dependencies, but allow you to remove the Docker image IF you add -f
(force) to your command.
Error response from daemon: conflict: unable to delete c15f15ccf180 (must be forced) - image is referenced in multiple repositories
The docker container
subcommand
In this 6-minute video, Tom describes the docker container
subcommand and the Docker container identifiers (e.g., CONTAINER ID or NAME):
docker container
show the docker container command optionsdocker container ls -a
list the docker containers currently running (such as any you failed to clean up)
docker container rm f9762fae8eca
removes the container using its CONTAINER ID.
- You can also remove the container using its name:
docker container rm focused_chandrasekhar
- If you don't like the automatically assigned container names, you can even assign a name to a docker container when you run it:
docker run --name cow -it godlovedc/lolcow
- You can list multiple container identifiers to remove multiple images:
docker container rm f3b0b1bb8eed f9762fae8eca cow
- Just like cleaning up Docker images, cleaning up Docker containers frees up disk space.
Digest
Summary
Docker builds its commands in a hierarchy: docker command subcommand
In this lesson, you explored the subcommands associated with docker image
and docker container
Stop and think about these concepts and terms
docker run
docker image ls
docker container ls -a