Docker Engine Basics
This page is a hands-on intro to running Docker Engine: checking the daemon, running your first containers, and understanding the daemon-versus-CLI split plus rootless mode.
Search across all documentation pages
This page is a hands-on intro to running Docker Engine: checking the daemon, running your first containers, and understanding the daemon-versus-CLI split plus rootless mode.
docker group, or use sudo, or run rootless mode.systemd to manage the daemon on most distributions.Quick install on Debian/Ubuntu via the official convenience script:
curl -fsSL https://get.docker.com | sh
sudo systemctl enable --now docker
docker versionVerify both halves of the client-server system report versions.
docker versiondocker CLI you typed.dockerd. If it is missing, the daemon is not running or your socket is wrong.docker info adds runtime details: storage driver, cgroup version, and the containerd/runc versions.systemctl start docker is needed.Start a container and see it print output, then exit.
docker run --rm hello-worlddocker run pulls the image if absent, creates a container, and starts it.--rm deletes the container when it exits, keeping your system clean./var/run/docker.sock.Detach a web server and map a port to the host.
docker run -d --name web -p 8080:80 nginx:1.27-d runs detached so your terminal returns immediately.--name web gives a stable handle instead of a random name.-p 8080:80 publishes container port 80 on host port 8080.nginx:1.27) rather than the moving latest.See what is running and where.
docker psdocker ps shows only running containers; add -a to include stopped ones.STATUS column reveals restarts and health-check state.docker ps --format '{{.Names}} {{.Ports}}' trims output to what you need.Stream stdout and stderr the daemon captured.
docker logs -f web-f follows the log stream like tail -f.json-file by default).--since 10m to bound noisy output.Exec into a running container for debugging.
docker exec -it web shexec starts a new process inside the container's namespaces.-it allocates an interactive TTY.sh for minimal images that lack bash.Clean up cleanly rather than killing processes.
docker stop web && docker rm webstop sends SIGTERM, waits (default 10s), then SIGKILL.rm deletes the stopped container and its writable layer.-v.docker rm -f web force-stops and removes in one step.The CLI is a client; point it at another engine without installing anything new.
export DOCKER_HOST=ssh://ops@buildhost
docker psDOCKER_HOST redirects every CLI call to a remote daemon.buildhost, not your laptop.Run the daemon and containers without real root to shrink the attack surface.
dockerd-rootless-setuptool.sh install
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
docker run --rm hello-worlddockerd inside a user namespace, so root in the container maps to your unprivileged UID.Set CPU and memory bounds so one container cannot starve the host.
docker run -d --name api \
--memory=512m --cpus=1.5 \
--restart=on-failure:3 \
myorg/api:1.4.0--memory caps RAM; the container is OOM-killed if it exceeds it.--cpus=1.5 limits it to one and a half cores via cgroups.--restart=on-failure:3 retries up to three times on non-zero exit.Stack versions: This page was written for Kubernetes 1.36.2, Docker Engine 29.6.1 (BuildKit default), containerd (CRI runtime on nodes), Helm 3, Compose v2, Argo CD (latest - verify at build), and Gateway API (GA - verify controller support at build).
Reviewed by Chris St. John·Last updated Jul 19, 2026