How can i configure containers to have a static IP even after restart?
What is your use case that you need a static IP on the container?
If you really want to map an IP to a container, that is possible without managing the actual IP of the container.
- Add the IP as a secondary IP to the host
- start the container with ports published to that IP:
docker run -p 22.214.171.124:443:443 -d mynginx
The normal docker networking stack is used. Your container’s published port listens on the secondary IP of 126.96.36.199. The actual container will get an auto-assigned IP address, but this is generally okay.
But how can i connect to this IP (188.8.131.52 for example) from any place outside the docker host?
You would add 184.108.40.206 to the host as a secondary ip before you would do the
docker run -p 220.127.116.11:443:443.