Cheat Sheets

JPNAS.NET / Cheat Sheets

🐳 Docker & Podman

Running self-hosted services in containers – starting, logs, updates and cleaning up. Podman uses the same commands: just write podman instead of docker.

Open in the interactive Cheat Sheets

Containers

docker ps docker ps -aRunning containers / all of them, also stopped ones.
docker run -d --name web -p 8080:80 nginxStart nginx in the background; port 80 inside is 8080 on this computer.
docker logs -f webFollow the log of a container.
docker exec -it web shOpen a shell inside a running container (bash if it has one).
docker stop web docker start web docker restart webStop / start / restart.
docker rm webDelete a stopped container. Data in volumes stays.

Images

docker imagesDownloaded images.
docker pull nginx:stableDownload or update an image.
docker rmi nginx:stableDelete an image.

Docker Compose

docker compose up -dStart everything described in compose.yaml in this folder.
docker compose downStop and remove the containers (volumes stay).
docker compose pull && docker compose up -dUpdate: download new images and recreate the containers.
docker compose logs -fLogs of all services together.
docker compose psStatus of the services in this project.

Data and cleaning up

docker volume lsVolumes – where the data of containers lives.
docker system dfHow much space images, containers and volumes use.
docker image pruneDelete images that no container uses any more.
docker system pruneDelete stopped containers, unused networks and dangling images. Volumes are kept unless you add --volumes.