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/01 Report--
This article mainly introduces what Docker-related commands are, which can be used for reference. Interested friends can refer to them. I hope you will gain a lot after reading this article.
Docker command
1. Command format:
Docker run-it-- name mydocker1 [image1] bash # individually named image1 as mydocker1
Docker run-it-- link mydocker1:mydocker1 [image2] bash connects two image so that image1 and image2 can communicate with each other
2. Command function:
Connect two container to communicate with each other
3. Command parameters:
-it-- name first name the first image1
-it-- link connects to the first image and can communicate with each other
4. Command example:
First open a window and enter the following command to open a docker window 1
[root@docker] # docker run-it-- name node1 node bash
Root@f2765d5fd9c8:/#
Open another window 2 again and enter the following command:
[root@docker] # docker run-it-- link node1:node1 node bash
Root@e85d11098482:/#
Enter the following command under the second docker window:
Root@e85d11098482:/# ping node1 shows that the ip address of node1 is 172.16.0.16
PING node1 (172.17.0.16): 56 data bytes
64 bytes from 172.17.0.16: icmp_seq=0 ttl=64 time=0.110 ms
64 bytes from 172.17.0.16: icmp_seq=1 ttl=64 time=0.073 ms
64 bytes from 172.17.0.16: icmp_seq=2 ttl=64 time=0.075 ms
64 bytes from 172.17.0.16: icmp_seq=3 ttl=64 time=0.094 ms
Cmurmuri-node1 ping statistics
4 packets transmitted, 4 packets received, 0 packet loss
Round-trip min/avg/max/stddev = 0.073 ms 0.088 ms 0.110 Compact
Enter the following command under the first docker window to see that the IP address of the window is the IP address of node1
Root@f2765d5fd9c8:/# ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
Link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Inet 127.0.0.1/8 scope host lo
Valid_lft forever preferred_lft forever
Inet6:: 1/128 scope host
Valid_lft forever preferred_lft forever
34: eth0@if35: mtu 1500 qdisc noqueue state UP group default
Link/ether 02:42:ac:11:00:10 brd ff:ff:ff:ff:ff:ff
Inet 172.17.0.16/16 scope global eth0
Valid_lft forever preferred_lft forever
Inet6 fe80::42:acff:fe11:10/64 scope link
Valid_lft forever preferred_lft forever
Thank you for reading this article carefully. I hope the article "what are the Docker-related commands" shared by the editor will be helpful to you? at the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.