Sometimes you may need to modify or add exposed ports to a Docker container during operation, but sometimes you don't want to create a new image for the running container. At this time, you can find the storage location of the docker container and then modify the configuration file directly. Our containers are all stored in My container is at Each container ID corresponds to a hash_id. You can see that the nginx container exposes two ports. Next, let's add another port 9999. Enter the directory corresponding to the container: cd /var/lib/docker/containers/797f3d0cb82aec7d1c355c7461b5bc5a050c1c0cbbe5d813ede0edad061e6632 We see: Copy hostconfig.json and use the json conversion tool to find the "PortBindings" node Next we will add one on top by following the same pattern. As shown in the figure: Modify Then modify Save and exit. Restart Docker, Restart the container. As you can see, port 9999 has been exposed. Summarize The above is the method that I introduced to you to dynamically add ports to Docker without re-building the image. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: MySQL Community Server 8.0.11 installation and configuration method graphic tutorial
>>: A detailed introduction to JavaScript primitive values and wrapper objects
Copy the following code to the code area of Drea...
This article mainly focuses on the installation a...
Angular Cookie read and write operations, the cod...
This article introduces a tutorial about how to u...
Install First you need to install Java and Scala,...
Table of contents Problem description: Cause Anal...
<div align="center"> <table sty...
1. Replication Principle The master server writes...
When learning mybatis, I encountered an error, th...
IIS7 Download the HTTP Rewrite module from Micros...
Table of contents 1. this keyword 2. Custom attri...
as follows: docker run -d -p 5000:23 -p 5001:22 -...
Table of contents SSH protocol SSH Connection pro...
A new window opens. Advantages: When the user cli...
Button is used quite a lot. Here I have sorted ou...