Docker Commands

The commands I use most often myself in everyday life on my server, to manage the various services in containers.

Last updated: September 1, 2026

Viewing containers

docker psShows all currently running containers
docker ps -aAlso shows stopped containers
docker logsShows a container's log output
docker statsShows resource usage of running containers in real time

Controlling containers

docker runCreates and starts a new container
docker startStarts a stopped container again
docker stopStops a running container gracefully
docker restartRestarts a container
docker exec -itOpens a terminal inside a running container

Cleaning up

docker rmDeletes a stopped container
docker rmiDeletes an image that's no longer needed
docker system pruneCleans up unused data all at once

Images

docker imagesShows all locally downloaded images
docker pullDownloads an image from a registry
docker buildBuilds your own image from a Dockerfile

Docker Compose

docker compose up -dStarts all services from a compose file in the background
docker compose downStops and removes all services from a compose file
docker compose logsShows the logs of all services from a compose file
docker compose restartRestarts all services from a compose file

Network and storage

docker network lsShows all existing Docker networks
docker network createCreates a new, dedicated network for containers
docker volume lsShows all persistent storage locations for container data
docker inspectShows detailed information about a container or image
Worth a look

From image to container

An image consists of several stacked layers, a container is a running instance of it.

Container (currently running)
Application code
Dependencies and libraries
Base image, e.g. Ubuntu

docker run creates a new, running container from an image.