Docker has been modified to create a container port mapping

Modify container port mapping has been created.

By editor hostconfig.jsonto modify the file Docker container port mapping

The file address:/var/lib/docker/containers/[hash_of_the_container]/hostconfig.json

Which hash_of_the_containeris the hash value of the corresponding container you need a complete hash value

View the complete hash value:docker inspect -f {{.ID}} containers_name

Then find the following modifications nodes:

"PortBindings":{}
// 格式如下
"PortBindings":{"8888/tcp":[{"HostIp":"","HostPort":"8888"}]}

Reference article: https://stackoverflow.com/questions/19335444/how-do-i-assign-a-port-mapping-to-an-existing-docker-container

Guess you like

Origin www.cnblogs.com/nwgdk/p/10953023.html