I've been studying Docker and all the options available. And I have a VPS with 3 extra static IPs.
The idea is to connect each container to a different IP or maybe add 3 networks with different containers and having each network connected to a different IP. I saw few days ago some tutorials in the internet but I didn't saved them and I can't find them any more.
The IPs are static and were delivered by our ISP (ovh).
So far I tried to connect to IPs using subnet xx.xx.xx.xx/32 (only 1 IP) but it gives me error
PS. I'm newbie at Docker.
Just tried this code
docker network create \
--driver=bridge \
--subnet=AAA.BBB.CCC.DDD/32 \
--ip-range=AAA.BBB.CCC.DDD/32 \
--gateway=AAA.BBB.CCC.DDD \
br0
and I'm getting the current error
Error response from daemon: failed to allocate gateway (AAA.BBB.CCC.DDD): No available addresses on this pool
Also AAA.BBB.CCC.DDD stands for the public IP coming from the ISP
An ip adress resolves to a certain place (if your dns server is able to resolve it at all) In this case i'm assuming that the static IP's resolve to the same machine: try to confirm that by running
Host xxx.xxx.xxx
note: use the ipv4 address so omit the slash If the same hostname is returned, my assumption is correct.
On this host, each container will have to expose a port and they can't use the same one. (one port per application)
So you'l either have to navigate to an ip followed by a colon and a port number... Or you can omit the port and have a web server like apache or nginx listen on the default port (80) and configure the routing based on the request received. (then you route it to the individually exposed ports, but this way the client doesn't have to know about those)
Hopefully this gives you some pointers to investigate the options for your goals.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.