Docker Command Reference Table
I’m currently learning Linux, AWS, DevOps, MySQL, and related technologies, aiming to become a Cloud Engineer. Passionate about cloud infrastructure and automation, I’m excited to apply these skills in real-world projects.
| Command / Option | Description |
docker run <image> | Run a container from an image |
docker run -d <image> | Run container in detached mode (in background) |
docker run -it <image> | Run container interactively with terminal |
docker run --name <name> <image> | Give container a custom name |
docker run -v <host_path>:<container_path> | Bind mount a volume (host dir ↔ container dir) |
docker run -p <host_port>:<container_port> | Map host port to container port |
docker run -m <memory_limit> | Set memory limit for the container (e.g. -m 512m) |
docker run --cpu-shares <value> | Set container CPU priority (relative weight) |
docker run --storage-opt size=<size> | Set container storage size limit (overlay2 driver) |
docker run --env <key>=<value> | Pass an environment variable |
docker run --env-file <file> | Load environment variables from a file |
docker ps | List running containers |
docker ps -a | List all containers (running + stopped) |
docker stop <container> | Stop a running container |
docker start <container> | Start a stopped container |
docker restart <container> | Restart a container |
docker kill <container> | Force stop a container immediately |
docker rm <container> | Remove a stopped container |
docker rm -f <container> | Force remove a running container |
docker images | List all images |
docker rmi <image> | Remove an image |
docker pull <image> | Download image from Docker Hub |
docker push <repo> | Push image to Docker Hub |
docker login | Login to Docker Hub |
docker logout | Logout from Docker Hub |
docker tag <image> <repo>:<tag> | Tag image for pushing to repo |
docker save -o <file>.tar <image> | Save image to tar archive |
docker load -i <file>.tar | Load image from tar archive |
docker exec -it <container> <cmd> | Run a command inside a running container (e.g. bash) |
docker inspect <container or image> | Show detailed info (JSON format) |
docker logs <container> | View logs from a container |
docker cp <container>:<path> <local> | Copy files from container to host |
docker cp <local> <container>:<path> | Copy files from host to container |
docker network ls | List Docker networks |
docker volume ls | List Docker volumes |
docker system df | Show Docker disk usage summary |
docker system prune | Clean up unused containers/images/networks/volumes |
#



