Chapter 9 Docker Command Line Interface (CLI)
9.1 General
docker --help
- Show all docker commandsdocker --version
- Show the Docker version information - Good for verifying that docker is installed
9.2 DockerHub
DockerHub (https://hub.docker.com/) contains many pre-built images that other users and organizations have created.
These commands are useful for connecting to a remote Docker registry to download docker images.
login
- Log in to a Docker registrylogout
- Log out from a Docker registrysearch
- Search the Docker Hub for imagespush
- Push an image or a repository to a registrypull
- Pull an image or a repository from a registrycommit
- Create a new image from a container’s changes
9.3 Containers
Use docker container --help
to list all “container management” commands. These are the common commands.
run
- Run a command in a new containerps
- List running containers (I usedocker container ls
, which does the same thing)stop
- Stop one or more running containersstart
- Start one or more stopped containersrm
- Remove one or more containers (I usedocker container rm
, which does the same thing)
9.4 Images
Use docker image --help
to list “image management” commands.
build
- Build an image from a Dockerfiletag
- Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEimages
- List images (I usedocker image ls
, which does the same thing)rmi
- Remove one or more images (I usedocker image rm
, which does the same thing)
Have a question? Leave a comment.