In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the example analysis of Docker port mapping, the article is very detailed, has a certain reference value, interested friends must read it!
Why port mapping?
When starting the container, if you do not configure the port mapping between the host machine and the virtual machine, external programs cannot access the virtual machine because there is no port.
What are the instructions for port mapping?
Docker instruction: docker run-p ip:hostPort:containerPort redis
Using the-p parameter assigns the port of the host to be mapped to the virtual machine.
IP represents the IP address of the host.
HostPort represents the port of the host.
ContainerPort represents the port of the virtual machine.
There are three supported formats:
Ip:hostPort:containerPort: maps the specified port of the specified address to the designated port of the virtual machine (rarely used)
For example, 127.0.0.1, 3306, which maps the local port 3306 to the virtual machine port 3306.
Ip::containerPort: maps any port of the specified address to the specified port of the virtual machine. (not commonly used)
For example, 127.0.0.1 virtual machine, which maps port 3306 of the machine to port 3306 of the virtual machine.
HostPort:containerPort: maps the designated port of the local machine to the designated port of the virtual machine. (commonly used)
For example, 3306, which maps port 3306 of the machine to port 3306 of the virtual machine.
How do I check if the mapping is successful?
Use the docker ps command to view
The presence of 6379/tcp indicates that the host does not open the port mapping with the virtual machine.
The appearance of 0.0.0.0 3306/tcp 3306-> indicates that port 3306 of the host is mapped to port 3306 of the virtual machine.
You can also use docker port NAME to view port mapping.
Indicates that port 3306 of the virtual machine is mapped to port 3306 of the host.
If there is no reply, the port mapping failed.
The above is all the contents of the article "sample Analysis of Docker Port Mapping". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.