How to set a docker container's iP?

2020-04-15 15:34发布

问题:

Can somebody tell me how to set a container's ip to a specific one ? I dont want to set the bridge to set of ips. All the results i get in net is to set range of ips to the docker bridge.

回答1:

You can use an existing IP of the host like so:

docker run -p 127.0.0.1:80:80 image etc.