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 -a | Running containers / all of them, also stopped ones. |
docker run -d --name web -p 8080:80 nginx | Start nginx in the background; port 80 inside is 8080 on this computer. |
docker logs -f web | Follow the log of a container. |
docker exec -it web sh | Open a shell inside a running container (bash if it has one). |
docker stop web docker start web docker restart web | Stop / start / restart. |
docker rm web | Delete a stopped container. Data in volumes stays. |
Images
docker images | Downloaded images. |
docker pull nginx:stable | Download or update an image. |
docker rmi nginx:stable | Delete an image. |
Docker Compose
docker compose up -d | Start everything described in compose.yaml in this folder. |
docker compose down | Stop and remove the containers (volumes stay). |
docker compose pull && docker compose up -d | Update: download new images and recreate the containers. |
docker compose logs -f | Logs of all services together. |
docker compose ps | Status of the services in this project. |
Data and cleaning up
docker volume ls | Volumes – where the data of containers lives. |
docker system df | How much space images, containers and volumes use. |
docker image prune | Delete images that no container uses any more. |
docker system prune | Delete stopped containers, unused networks and dangling images. Volumes are kept unless you add --volumes. |