Chapter 9 Docker Command Line Interface (CLI)

9.1 General

  • docker --help - Show all docker commands
  • docker --version - Show the Docker version information - Good for verifying that docker is installed

9.2 DockerHub

DockerHub ( 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 registry
  • logout - Log out from a Docker registry
  • search - Search the Docker Hub for images
  • push - Push an image or a repository to a registry
  • pull - Pull an image or a repository from a registry
  • commit - 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 container
  • ps - List running containers (I use docker container ls, which does the same thing)
  • stop - Stop one or more running containers
  • start - Start one or more stopped containers
  • rm - Remove one or more containers (I use docker 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 Dockerfile
  • tag - Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  • images - List images (I use docker image ls, which does the same thing)
  • rmi - Remove one or more images (I use docker image rm, which does the same thing)

Become a Expert Shiny Developer with AWS

Business Science

Have a question? Leave a comment.