Index |
Command |
Description |
1 |
docker version |
Show the Docker version information |
2 |
docker info |
Show system-wide information about Docker |
3 |
docker pull <image_name> |
Pull an image from Docker Hub |
4 |
docker images |
List all local images |
5 |
docker run <image_name> |
Run a container from an image |
6 |
docker ps |
List all running containers |
7 |
docker ps -a |
List all containers (running and stopped) |
8 |
docker start <container_id> |
Start a stopped container |
9 |
docker stop <container_id> |
Stop a running container |
10 |
docker rm <container_id> |
Remove a container |
11 |
docker rmi <image_id> |
Remove an image |
12 |
docker exec -it <container_id> bash |
Run a command inside a running container |
13 |
docker build -t <image_name> . |
Build an image from a Dockerfile |
14 |
docker-compose up |
Start services defined in a Compose file |
15 |
docker-compose down |
Stop and remove containers created by ‘up’ |
16 |
docker-compose ps |
List services |
17 |
docker-compose logs |
Show logs for all services |
18 |
docker-compose exec <service_name> <command> |
Execute a command in a running service container |
19 |
docker-compose build |
Build or rebuild services |
20 |
docker-compose restart <service_name> |
Restart a service |
21 |
docker-compose pause <service_name> |
Pause a service |
22 |
docker-compose unpause <service_name> |
Unpause a service |
23 |
docker-compose scale <service_name>=<num_containers> |
Scale a service to a specific number of containers |
24 |
docker logs <container_id> |
Show logs of a container |
25 |
docker inspect <container_id> |
Show low-level information about a container |
26 |
docker cp <container_id>:/path/to/container/file /host/path |
Copy files/folders between a container and host |
27 |
docker stats |
Show resource usage statistics of running containers |
28 |
docker kill <container_id> |
Kill a running container |
29 |
docker pause <container_id> |
Pause a running container |
30 |
docker unpause <container_id> |
Unpause a paused container |
31 |
docker top <container_id> |
Display the running processes of a container |
32 |
docker attach <container_id> |
Attach local standard input, output, and error streams to a running container |
33 |
docker build -f <Dockerfile> -t <image_name> . |
Build an image from a specified Dockerfile |
34 |
docker commit <container_id> <image_name> |
Create a new image from a container’s changes |
35 |
docker export <container_id> > filename.tar |
Export a container’s filesystem as a tar archive |
36 |
docker import filename.tar |
Create a new filesystem image from the contents of a tarball |
37 |
docker save -o filename.tar <image_name> |
Save one or more images to a tar archive |
38 |
docker load -i filename.tar |
Load an image from a tar archive |
39 |
docker network ls |
List networks |
40 |
docker network inspect <network_id> |
Show information about a network |
41 |
docker network create --driver <driver> <network_name> |
Create a network |
42 |
docker network connect <network_id> <container_id> |
Connect a container to a network |
43 |
docker network disconnect <network_id> <container_id> |
Disconnect a container from a network |
44 |
docker system prune |
Remove all unused data |
45 |
docker system prune -a |
Remove all unused data including stopped containers and unused images |
46 |
docker system df |
Show docker disk usage |