In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The Docker container may sometimes need to modify or add exposed ports during operation, but sometimes the running container does not want to create a new image. At this point, you can find the storage place of the docker container, and then modify the configuration file directly.
Our containers are all stored under / var/lib/docker/containers.
My container is in / var/lib/docker/containers/797f3d0cb82aec7d1c355c7461b5bc5a050c1c0cbbe5d813ede0edad061e6632
Each container ID corresponds to a hash_id, and you can see that the nginx container exposes two ports. Let's add an extra 9999 port.
Enter the directory corresponding to the container:
Cd / var/lib/docker/containers/797f3d0cb82aec7d1c355c7461b5bc5a050c1c0cbbe5d813ede0edad061e6632
We see:
Copy the hostconfig.json and use the json conversion tool to find the "PortBindings" node
Then we will add one to it according to the picture.
As shown in the figure:
Modify the hostconfig.json and save it.
Then modify the ExposedPorts of config.v2.json, as shown below:
Save exit.
Restart docker
Restart the container.
As you can see, port 9999 has been exposed.
Summary
The above is the editor to introduce to you the Docker dynamic add port does not need to re-establish a mirror image method, I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
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.