Docker common commands list with examples

Docker is an open source application container engine that allows developers to package their applications and dependencies into a portable image, then publish it to any popular Linux or Windows machine, or implement virtualization. Containers are fully sandboxed and there will be no interfaces between them.

Docker includes three basic concepts:

  • Repository
  • Image
  • Container

Docker uses a client-server (C/S) architecture pattern and uses remote APIs to manage and create Docker containers.

This article shares common commands of docker and examples.

Image Repository Commands

  • pull
            Pull an image or a repository from a registry
  • push
            Push an image or a repository to a registry
  • search
          Search the Docker Hub for images

Local Image Manage Commands

  • images
          List images
  • rmi
         Remove one or more images
  • tag
         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  • build
         Build an image from a Dockerfile
  • commit
          Create a new image from a container’s changes
  • history
        Show the history of an image
  • import
          Import the contents from a tarball to create a filesystem image
  • save
          Save one or more images to a tar archive
  • inspect
        Display detailed information on one or more images

Container  Manage Commands

  • ps
          List containers
  • top
         Display the running processes of a container
  • attach
          Attach local standard input, output, and error streams to a running container
  • port
          List port mappings or a specific mapping for the container
  • wait
          Block until one or more containers stop, then print their exit codes
  • logs
          Fetch the logs of a container
  • export
          Export a container’s filesystem as a tar archive
  • port
          List port mappings or a specific mapping for the container

Container Lifecycle Manage Commands

  • create
          Create a new container
  • rename
          Rename a container
  • run
         Run a command in a new container
  • exec
          Run a command in a running container
  • start
          Start one or more stopped containers
  • restart
        Restart one or more containers
  • stop
           Stop one or more running containers
  • stats
          Display a live stream of container(s) resource usage statistics
  • kill
            Kill one or more running containers
  • rm
            Remove one or more containers
  • unpause
        Unpause all processes within one or more containers
  • update
          Update configuration of one or more containers

Docker Management Commands

  • builder
        Manage builds
  • checkpoint
      Manage checkpoints
  • config
          Manage Docker configs
  • container
      Manage containers
  • context
        Manage contexts
  • image
          Manage images
  • network
        Manage networks
  • node
            Manage Swarm nodes
  • plugin
          Manage plugins
  • secret
          Manage Docker secrets
  • service
        Manage services
  • stack
          Manage Docker stacks
  • swarm
          Manage Swarm
  • system
          Manage Docker
  • trust
          Manage trust on Docker images
  • volume
          Manage volumes

Run ‘docker COMMAND –help‘ for more information on a command.

Add a Comment

Your email address will not be published. Required fields are marked *