cheat-sheets

Docker Desktop

Docker Desktop is Docker’s desktop app for Windows, macOS and Linux. It bundles the Docker Engine, the docker CLI, Docker Compose, a built-in Kubernetes cluster and a GUI inside a lightweight VM. For the engine and commands see Docker and Docker-Compose; on Linux servers you normally install Docker Engine directly instead.

Documentation: Docker Desktop Docs

Licence: Docker Desktop is free for personal use, education, open source and small businesses, but larger organisations need a paid subscription. Check the current terms on the Docker site.


Install #

PLATFORMCOMMAND
Windowswinget install Docker.DockerDesktop or choco install docker-desktop (Chocolatey)
macOSbrew install --cask docker (Homebrew)
Linuxthe .deb or .rpm package from the Docker docs

Windows uses the WSL 2 backend by default (see WSL Cheat-Sheet). On Apple Silicon see Docker on macOS Silicon for architecture notes.

Windows: WSL 2 Integration #

Settings > Resources > WSL integration enables Docker inside chosen distros. In the distro, docker version should then show both client and server. If docker is not found, restart the distro (wsl --shutdown from PowerShell) and check that integration is on for that distro.

Built-in Kubernetes #

Settings > Kubernetes > Enable Kubernetes creates a single-node cluster and a docker-desktop context for Kubectl:

bash
kubectl config use-context docker-desktop
kubectl get nodes

For multi-node local clusters see Kind, and for a lightweight real distribution see K3S.

Resources and Cleanup #

  • Settings > Resources sets CPUs, memory, swap and the disk image size. Raise memory if builds or databases get OOM-killed.
  • Disk grows with images and volumes. Clean up with:
COMMANDDESCRIPTION
docker system dfShow disk use
docker system pruneRemove stopped containers, unused networks and dangling images
docker system prune -a --volumesAggressive: also unused images and volumes (check first, volumes hold data)
docker builder pruneClear the build cache

Useful Features #

  • Dev Environments, Extensions and Docker Scout (image vulnerability scanning) are available in the GUI.
  • docker context ls shows desktop-linux (or default) and any remote contexts.
  • docker compose (plugin, with a space) is the current command; docker-compose (hyphen) is the old standalone tool.
  • Host networking and host.docker.internal differ from native Linux. Use host.docker.internal to reach services on the host from a container.

Troubleshooting #

  • Engine will not start: restart Docker Desktop, check virtualisation is enabled in BIOS and, on Windows, that WSL 2 is installed and updated (wsl --update).
  • Slow bind mounts on macOS or WSL: keep project files inside the Linux filesystem (WSL) or use named volumes.
  • Port already in use: docker ps to find the owner, or change the host port in -p HOST:CONTAINER.

Not Verified #

Written from knowledge and not run here. Menu names and licence terms change between releases.

Search all sheets

Tip: / or Ctrl/Cmd+K to open, Esc to close.