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. |