admin avatar

Docker command all

🕔 by admin

Docker command all

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
apt-get install docker-ce # install docker

apt-get -y autoremove docker-*  #remove docker all

docker ps-a # view all containers on the host (physical server)


docker exec -it Debian /bin/bash # goes inside the running container,

docker exec -it demo4f34ddedd /bin/bash

Use the mirror ID to enter the inside of the running container, but the ID will change. It is recommended to use the name to enter the container

docker inspect Debian # to see the container's details, such as the IPAddress

docker pulls nginx # to take the nginx container image

docker pull debian:8 # pulls the container image of debian 8

docker search-s 10 debian # debian container images with search ranking greater than 10

docker search debian # simply searches for deian container images

docker run --privileged -- it debian: 8.3/bin/bash # add root rights to the container

docker run-p 8080:8080 -it debian: 8.3/bin /bash

# opens the Debian 8.3 container port map, which maps port 8080 of the container to port 8080 of the host

Docker run-p 172.0.0.3:8080:8080-it debian: 8.3/bin /bash

# specifies the IP port mapping for the container

docker run-p 0.0.0.0:8080:8080 -it debian:8.3 /bin/bash

Open arbitrary network connections to container mappings

docker run-p 3399:3399 -p 555:777-p 6666: 6666-p 777:777 --name debian-it debian: 8.3/bin /bash

Multi-port mapping and granting terminal permissions, the first IP is the host's port and the second IP is the IP port inside the container.

Exit # exits the internal container terminal

docker start/restart/stop  id/name  # start, restart, stop the container

docker export f2054f7b52a7ed3 | gzip > debian8.3.tar.gz # container packs the backup

zcat debian8.3.tar.gz | docker import - debian nginx:1 # container import

docker save -o debian8.3.tar a38fabc72285 # container image clone

docker load - i debian8.3.tar # container image import

docker commit f2017b3a5ed4 debian: 1

Clone a debian:1 container image from IDf2017b3a5ed4 container image

docker rm [container ID] # removes the container

docker rmi [mirror ID] # removes the container image

docker rmi -f [mirror ID] # forces the violent removal of the container image

💘 相关文章

写一条评论