In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Summary of common commands in docker
Docker search centos:7.2.1511 # with a specified version number
Docker search centos # default latest without version number
Docker pull warehouse server: Port / project name / image name: tag (version) number
View local image: docker images
Name of the repository to which the REPOSITORY # image belongs
TAG # image version number (identifier), default is latest
IMAGE ID # Image unique ID tag
CREATED # Image creation time
Size of the VIRTUAL SIZE # image
Command summary:
Docker load-I centos-latest.tar.xz # Import local image docker save centos > / opt/centos.tar # centos # Export image docker rmi image ID/ image name # delete the image of the specified ID, when starting the container through the image
The waiting mirror cannot be deleted unless all the containers are closed
Docker rm Container ID/ Container name # Delete Container docker rm Container ID/ Container name-f # Force deletion of a running container
Delete Container Operation
Docker stop $(docker ps-a-Q) # closes all running containers normally
Docker kill $(docker ps-a-Q) # forcibly closes all running containers
Docker rm-f docker ps-aq-f status=exited batch delete exited containers
Docker rm-f $(docker ps-a-Q) batch delete all containers
Will go directly to the container and randomly generate the container ID and name
[root@docker-server1 ~] # docker run-it docker.io/centos bash
[root@11445b3a84d3 /] #
# exit the container without logging out of ctrl+p+q
Docker ps-a # shows all containers
Specify port mapping:
Method 1: local port 81 is mapped to container port 80:
Docker run-p 81:80-name nginx-test-port1 nginx
Method 2: local IP: local port: container port
Docker run-p 192.168.10.205 docker run 82bureau 80-- name nginx-test-port2 docker.io/nginx
Method 3: local IP: local random port: container port
Docker run-p 192.168.10.205-name nginx-test-port3 docker.io/nginx
Method 4: native ip: local port: container port / protocol. Default is tcp protocol.
Docker run-p 192.168.10.205:83:80/udp-- name nginx-test-port4
Docker.io/nginx
Method 5: map multiple ports + protocols at one time:
Docker run-p 86:80/tcp-p 443:443/tcp-p 53:53/udp-- name nginx-test-port5
Docker.io/nginx
# View the Nginx container access log:
[root@docker-server1 ~] # docker logs nginx-test-port3 # View at once
[root@docker-server1 ~] # docker logs-f nginx-test-port3 # continuously view
Docker port nginx-test-port5
Docker run-it-- name nginx-test nginx
Docker run-d-P-- name nginx-test1 docker.io/nginx # background launch container
Create and enter the container:
[root@docker-server1] # docker run-t-I-name test-centos2 docker.io/centos / bin/bash
[root@a8fb69e71c73 /] # # enter the container directly after creating the container
Docker run-d-name centos-test1 docker.io/centos running in the background
Docker run-it-rm-name nginx-delete-test docker.io/nginx
Use the attach command:
# the docker attach container name is used. Attach is similar to vnc, and the operation will be performed in each container interface.
Shows that all operations that enter the container in this way are displayed synchronously and the container will be closed after exit
Closed, and the container is closed after exiting with exit. It is not recommended. You need to enter the capacity with shell environment.
Devices, such as centos, for example:
[root@s1 ~] # docker run-it centos bash
[root@63fbc2d5a3ec /] #
[root@s1 ~] # docker attach 63fbc2d5a3ec
[root@63fbc2d5a3ec /] #
Enter the running container
Docker exec-it 8b32ccf52307 bash
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.