Skip to content

Overview ๐Ÿ“˜

Docker Commands

S.No Command Description
1 docker build -t <image_name>:<tag> . ๐Ÿณ Build a Docker image with the specified name and tag from the current directory (Dockerfile location).
2 docker run -p <host_port>:<container_port> <image_name>:<tag> ๐Ÿƒ Run a Docker container based on the specified image, mapping a host port to a container port.
3 docker ps ๐Ÿ“‹ List all running Docker containers.
4 docker ps -a ๐Ÿ“‹ List all Docker containers, including stopped ones.
5 docker stop <container_id_or_name> โน๏ธ Stop a running Docker container by its ID or name.
6 docker rm <container_id_or_name> ๐Ÿ—‘๏ธ Remove a stopped Docker container by its ID or name.
7 docker rmi <image_name>:<tag> ๐Ÿ—‘๏ธ Remove a Docker image by its name and tag.
8 docker images ๐Ÿ“ท List all Docker images on your system.
9 docker pull <image_name>:<tag> โฌ‡๏ธ Pull a Docker image from a Docker registry.
10 docker push <image_name>:<tag> โฌ†๏ธ Push a Docker image to a Docker registry.
11 docker exec -it <container_id_or_name> <command> ๐Ÿ’ป Execute a command in a running Docker container with interactive mode.
12 docker logs <container_id_or_name> ๐Ÿ“œ View the logs of a running Docker container.
13 docker network ls ๐ŸŒ List all Docker networks.
14 docker volume ls ๐Ÿ’พ List all Docker volumes.
15 docker-compose up ๐Ÿš€ Start services defined in a Docker Compose file.
16 docker-compose down โฌ‡๏ธ Stop and remove services defined in a Docker Compose file.
17 docker system prune ๐Ÿงน Remove all stopped containers, unused networks, and dangling images and volumes to free up disk space.
18 docker version โ„น๏ธ Display Docker version information.
19 docker info โ„น๏ธ Display Docker system-wide information.
20 docker --help โ“ Display Docker help and available commands.