Skip to content

400 Software Development


DOCKER — Core Cheat Sheet

Architecture

  • Client: docker CLI
  • Daemon: dockerd (does the work)
  • Registry: where images live

Images (Build-time)

  • Image: immutable filesystem + metadata
  • Dockerfile: build recipe
  • Layer: cached filesystem diff
  • Tag: human label (nginx:1.25)
  • Digest: real identity (hash)
  • Base image: starting point

Core commands:

docker build -t app . 
docker pull image 
docker push image 
docker images

Containers (Run-time)

  • Container: running instance of image
  • PID 1: main process
  • Lifecycle: create → start → stop → rm

Core commands:

docker run 
docker ps 
docker stop 
docker exec 
docker logs 
docker rm

Storage

  • Volume: Docker-managed (preferred)
  • Bind mount: host path
  • tmpfs: memory only

Core commands:

docker volume create

Networking

  • Bridge (default)
  • Host
  • Overlay
  • Port mapping: HOST:CONTAINER
  • DNS: container name resolution

Core commands:

docker network create

Inspection & Ops

Core commands:

docker inspect 
docker stats 
docker system df 
docker prune

Installing Docker

  1. Set up Docker's apt repository.
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
  1. Install the Docker packages.
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

See also