Docker
Docker commands for containers and images
DevOps
Images
docker pull <image>Download image
docker imagesList images
docker build -t <name> .Build image from Dockerfile
docker rmi <image>Remove image
docker tag <img> <new>Tag an image
docker push <image>Push to registry
Containers
docker run <image>Create and start container
docker run -d <image>Run in background
docker run -p 8080:80 <img>Map ports
docker run -v /host:/containerMount volume
docker psList running containers
docker ps -aList all containers
docker stop <container>Stop container
docker start <container>Start container
docker rm <container>Remove container
Inspection & Logs
docker logs <container>View logs
docker logs -f <container>Follow logs
docker inspect <container>Detailed info
docker exec -it <c> bashEnter container shell
docker statsContainer resource usage
Docker Compose
docker-compose upStart services
docker-compose up -dStart in background
docker-compose downStop and remove
docker-compose logsView logs
docker-compose buildBuild services
docker-compose psList services
Cleanup
docker system pruneRemove unused data
docker image pruneRemove unused images
docker container pruneRemove stopped containers
docker volume pruneRemove unused volumes