Container installation and maintenance
1. install and configure docker
# Yum install docker
650) This. width = 650; "Title =" Capture 1.png" alt = "wkiol1guyu7w1yzbaaaxiiemgbi685.png" src = "http://s1.51cto.com/wyfs02/M01/8A/57/wKioL1guYU7w1YZbAAAxiieMgBI685.png"/>
2. Start the docker daemon process:
# Systemctl start docker
# Systemctl status docker
# Systemctl enable docker
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiol1guy1yaoiziaaaqpzcbvoa263.png "src =" http://s3.51cto.com/wyfs02/M01/8A/58/wKioL1guY1yAOIZiAAAQPzCbVOA263.png "/>
3. Run the container daemon and test image:
# Docker run Hello-world
You should see the following information:
"Hello from docker. This message shows that your installation appears to be working correctly ."
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiom1guzbvrxhrnaabntskssmq235.png "src =" http://s5.51cto.com/wyfs02/M02/8A/5B/wKiom1guZbvRxHrnAABNTSkSSmQ235.png "/>
4. Basic docker commands:
# Docker info
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiom1guagnz68snabhgbdaspi876.png "src =" http://s3.51cto.com/wyfs02/M01/8A/5C/wKiom1guaGnz68snAABHGbdasPI876.png "/>
# Docker version
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiom1gubukhnvtdaaadacwi9sy981.png "src =" http://s5.51cto.com/wyfs02/M02/8A/5C/wKiom1gubUKhNVtDAAAdACWi9SY981.png "/>
5. List docker commands:
# Docker
650) This. width = 650; "Title =" Capture. PNG "alt =" wKiom1gubs_Sabi-AABLBj9Iujw809.png "src =" http://s1.51cto.com/wyfs02/M02/8A/5C/wKiom1gubs_Sabi-AABLBj9Iujw809.png "/>
Download a docker image file,Docker Hub
6. Search docker image file command:
# Docker search centos
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiom1gufyycxb_4aaqv5nmhxyu422.png "src =" http://s5.51cto.com/wyfs02/M00/8A/5D/wKiom1gufYyCXB_4AAQv5nmhxYU422.png "/>
7. Download the local image file:
# Docker pull centos
650) This. width = 650; "Title =" Capture. PNG "alt =" wKiom1gufs-yQSgIAADcAscSg3A253.png "src =" http://s4.51cto.com/wyfs02/M01/8A/5D/wKiom1gufs-yQSgIAADcAscSg3A253.png "/>
8. Get the docker Image File
# Docker Image
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiol1gugz3xeabiaabk4s9ujv4567.png "src =" http://s3.51cto.com/wyfs02/M02/8A/59/wKioL1gugZ3xeabIAABk4s9UJv4567.png "/>
9. Remove the docker Image File
# Docker RMI centos
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiol1gugtxyasxvaacv7ebl4yi984.png "src =" http://s2.51cto.com/wyfs02/M01/8A/59/wKioL1gugtXyAsxvAACv7eBl4YI984.png "/>
Run docker containers
The created container is retained in the host file system. You can use the docker RM command to remove it.
10. First, compare the version files. The following example is created previously.
# Docker run Ubuntu CAT/etc/issue
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiol1gui8hqcerfaaapxbh8po0782.png "src =" http://s3.51cto.com/wyfs02/M02/8A/5A/wKioL1gui8HQceRFAAAPxbh8PO0782.png "/>
The preceding command is used as follows:
# Docker run [local image] [command to run into container]
11. To run a container, you must obtain the container ID or name generated by Doker. The following shows the running or stopped containers.
# Docker PS-l
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiom1gukujykagfaaatm zuxx6c813.png "src =" http://s1.51cto.com/wyfs02/M01/8A/5E/wKiom1gukujyKaGfAAATMzuXX6c813.png "/>
12. Use the ID to start the container/You can also use the name
# Docker start c629b7d70666
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiol1gurijbq1jiaaaxgumersa592.png "src =" http://s5.51cto.com/wyfs02/M02/8A/5B/wKioL1gurijBQ1jiAAAXGumERSA592.png "/>
13. Use the ID to stop the container/You can also use the name
# Docker stop dreamy_mccarthy
# Docker PS
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiol1gunrejtmlfaabf4h5r7im984.png "src =" http://s2.51cto.com/wyfs02/M00/8A/5B/wKioL1gunRejtMLfAABF4h5r7iM984.png "/>
14. If you forget the container ID, use the -- name option:
# Docker run -- name myname Ubuntu CAT/etc/debian_version
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiom1gusdnqehd3aab_lx9xqn8216.png "src =" http://s5.51cto.com/wyfs02/M00/8A/5F/wKiom1gusDnQeHD3AAB_lx9Xqn8216.png "/>
15. You can use the following name: (start, stop, remove, top, stats ):
# Docker start myname
# Docker stats myname
# Docker top myname
Run interactive sessions
16. Interactive container connection command:
# Docker run-It Ubuntu bash
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiol1gutteb2lmxaabocysjze0260.png "src =" http://s2.51cto.com/wyfs02/M01/8A/5D/wKioL1gutteB2lmXAABOCySJZE0260.png "/>
-I.
-T lock the terminal to stdin and stdout.
Ubuntu creates an image file for the container.
Bash runs on Ubuntu containers
17. use Ctrl + P and CTRL + Q to exit your container and use docker attach to re-enter the container .:
Do not forget to exit the container with exit
650) This. width = 650; "Title =" Capture. PNG "alt =" wkiom1guyocq3fggaaburb5j6mo427.png "src =" http://s4.51cto.com/wyfs02/M00/8A/69/wKiom1guyOCQ3FGgAABURB5j6mo427.png "/>
18. The docker attach Command requires the container ID or name ::
# Docker attach container ID
19. Stop the container and run the kill command on the host:
# Docker kill container ID
This article is from the blog "ruihang departure-next-generation enterprise application!
Centos7 docker container (1) installation and maintenance