Container Commands
bash
1# List running containers
2docker ps
3
4# List all containers (including stopped)
5docker ps -a
6
7# Stop a container
8docker stop <container_id>
9
10# Start a stopped container
11docker start <container_id>
12
13# Remove a container
14docker rm <container_id>
15
16# View container logs
17docker logs <container_id>
18
19# Execute command in container
20docker exec -it <container_id> bashImage Commands
bash
1# List images
2docker images
3
4# Pull an image
5docker pull nginx:latest
6
7# Remove an image
8docker rmi nginx:latest
9
10# Search Docker Hub
11docker search pythonSystem Commands
bash
1# System info
2docker info
3
4# Disk usage
5docker system df
6
7# Clean up unused resources
8docker system prune
9
10# Remove all stopped containers
11docker container pruneQuick Reference
bash
1# Run and remove after exit
2docker run --rm -it ubuntu bash
3
4# Run with environment variable
5docker run -e MY_VAR=value nginx
6
7# Copy files to container
8docker cp file.txt container:/path/