In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. Docker's basic command [root@node02 ~] # docker volume prune-f # deletes unowned data volumes # when you run the container, the-v mounts directories without specifying local directories to be mounted, but is managed by docker. # when the container is deleted, these directories will not be deleted. In this case, such directories are unowned data volumes. # to delete these volumes at the same time when deleting containers, you can use the following command (add the "- v" option): [root@node02 ~] # docker rm-f-v 8086 # where 8086 is the container ID [root@master volumes] # docker container prune-f # clean up all containers in the terminated state. [root@localhost ~] # docker search dhcp # search for an image [root@localhost ~] # docker pull docker.io/networkboot/dhcpd # download a queried image [root@localhost ~] # docker images # query the downloaded image [root@localhost ~] # docker tag docker.io/networkboot/dhcpd dchp:dhcp # change its name and label [root@localhost ~] # docker rmi docker.io / networkboot/dhcpd # Delete image [root@localhost ~] # docker save-o dhcptest dchp:dhcp # Export as local image [root@localhost ~] # docker load-- input dhcp # Import image # or [root@localhost ~] # docker load
< dhcp #导入镜像[root@docker ~]# docker save >Dhcp busybox:latest # Export image busybox [root @ localhost ~] # docker push docker.io/ljztest/dhcp # upload image [root@localhost ~] # docker create-itd dchp:dhcp / bin/bash # create a container And specify the pseudo terminal # option to be explained as follows: *-I: interactive *-t: assign one for the terminal *-d: run [root@docker] # docker run-itd-- name test2-- restart=always httpd # keep the container in the boot self-boot state # the function is to restart the container when "systemctl restart docker" is executed # if you do not add-- restart, then once "systemctl restart docker" is executed, the container will stop. [root@localhost ~] # docker ps-a # check the ID number of the container [root@localhost ~] # docker exec-it 2304f92a8158 / bin/bash # enter a container [root@docker ~] # docker attach test1 # also enter a container # if you enter the container and use exit to exit, the container will also be closed. # using ctrl+p ctrl+q to exit the container will not close the container, but will keep the container running. [root@docker ~] # docker ps-a-Q | xargs docker start # Open all containers [root@docker ~] # docker ps-a-Q | xargs docker stop # close all containers [root@docker ~] # docker logs test1 # to view container logs, you can add the "- f" option to dynamically output [root@docker ~] # docker ps-a-Q | xargs docker rm-f # delete all containers No less powerful than rm-rf / * [root@localhost ~] # docker ps-a-Q | xargs docker start # starts all containers [root@localhost ~] # docker rm 2304f92a8158 # Delete containers [root@docker ~] # docker run-it-- name containerB-c 512 centos# to create a container called containerB Set the weight of its CPU to 512 [root@docker ~] # docker run-it-- name testA-- device-write-bps / dev/sda:30MB centos# limit the size of the disk that can be written per second to 30MB#, and there are the following options: #-- device-read-bps: set the bps#--device-write-bps of the read device: set the bps#--device-read-iops of the write device: set the iops#-- of the read device Device-write-iops: sets the iops of the writing device. [root@docker lv] # docker history test04:latest # if you use Dockerfile to create an image, you can use this command to see what the image has done [root@docker ~] # docker logs web01 # to view the container log. You can add the "- f" option to refresh dynamically. [root@docker ~] # docker commit web01 mytest:v1.0 # make the container as an image [root@docker ~] # docker cp / a.txt web01:/usr # copy the local files into the container [root@docker ~] # docker cp web01:/usr/a.txt / usr # copy the files in the container to the local machine. Commands related to docker network management: [root@docker ~] # docker network ls # View docker's network [root@docker ~] # brctl show # dedicated to view virtual network [root@docker ~] # docker exec web ip a # View the network information of a specified container [root@docker ~] # docker network create-d bridge my_net # create a docker network -d: specify the driver type [root@docker ~] # docker network create-d bridge-- subnet 172.22.0.0Accord24 my_net2 # when creating a network Specify the network segment [root@docker ~] # docker network inspect my_net2 # View the details of this network [root@docker ~] # docker inspect web05 # View the details of the container [root@docker ~] # docker inspect web05 # View the details of the container [root@docker ~] # docker run-tid-- name web07-- network my_net2-- ip 172.22.0.8 busybox # specify the IP address when starting the container. [root@docker ~] # docker exec web03 ping 172.17.0.3 # does not enter the virtual machine to execute ping commands. [root@docker ~] # iptables-save # View the iptables rule [root@docker ~] # docker network connect my_net web001 # Connect web001 to the my_net network. After execution, the web001 will have an extra network card and have the IP address of the my_net network. 3. Docker Swarm Cluster Common commands [root@docker01 ~] # docker node ls # View cluster information (can only be viewed on hosts in the manager role) [root@docker01 ~] # docker swarm join-token worker # if you need to join the worker side later, you can execute this command to view the token (that is, the command to be executed when joining) [root@docker01 ~] # docker swarm join-token manager # ditto, to join the manager side You can execute this command to view the token. Dynamic expansion and reduction of [root@docker01 ~] # docker service scale web05=6 # Container [root@docker01 ~] # docker service ps web01 # View the nodes on which the created container runs [root@docker01 ~] # docker service ls # View the created service # detach the docker03 from the cluster [root@docker03 ~] # docker swarm leave # docker03 from the cluster [root@docker01 ~] # docker node rm docker03 # then remove docker03 [root@docker01 ~] # docker node promote docker02 # on the server of the manager role and upgrade docker02 from worker to manager. # after upgrade, docker02 status will be Reachable [root@docker01 ~] # docker node update-- availability drain docker01# sets host docker01 not to run containers, but containers that are already running will not stop
-this is the end of this article. Thank you for reading-
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.