Skip to main content

Docker Commands Reference Guide

Updated 2 min readMarkdown
Docker Commands Reference Guide

Running and Managing Containers

  • docker run: Creates and starts a container from an image.
  • docker ps: Lists running containers.
  • docker container list -a: Lists all containers, including stopped ones.
  • docker stop: Gracefully stops a running container.
  • docker kill: Non-gracefully kills a running container.
  • docker container logs: Views the logs of a container.
  • docker container attach: Attaches your terminal to a running container's streams.
  • docker exec: Runs a new command inside a running container.
  • docker container top: Shows processes running inside a container.
  • docker container wait: Stops a script until a container exits.
  • docker container prune: Removes all stopped containers.
  • docker rm: Removes a specific container.

Managing Images

  • docker image build: Builds an image from a Dockerfile.
  • docker image history: Shows the build steps for an image.
  • docker image inspect: Displays detailed metadata about an image.
  • docker image tag: Tags an image with a new name or version.
  • docker scan: Scans an image for vulnerabilities.
  • docker image prune: Removes unused images.

Volumes and Networks

  • docker volume create: Creates a named volume.
  • docker volume inspect: Inspects volume configuration.
  • docker volume ls: Lists available volumes.
  • docker volume prune: Removes unused volumes.
  • docker volume rm: Removes a specific volume.
  • docker network: Used for creating, inspecting, listing, or pruning network objects.

Orchestration and Deployment

  • docker swarm init: Initializes swarm mode on a host.

About the author

No comments yet. Be the first to comment.