← Knowledge Base
DockerReference note1 min read · updated 2026-11-27

Docker: the commands you use every day

Run, list, inspect, log into and clean up containers and images.

dockercontainerscli
docker run -d --name web -p 8080:80 nginx:alpine   # run in the background, publish a port
docker ps                  # running containers   (docker ps -a for all)
docker logs -f web         # follow logs
docker exec -it web sh     # shell inside the container
docker stop web && docker rm web
docker images; docker pull nginx:alpine; docker rmi nginx:alpine
docker inspect web         # full JSON details
docker stats --no-stream
docker system df           # space used
docker system prune        # remove stopped containers, unused networks, dangling images (asks first)

Data written inside a container disappears when it is removed; keep data in volumes or bind mounts. -p 8080:80 maps host port 8080 to container port 80.