networking - Assign different IPs to different Docker container -


i need run 2 containers each containing script binding on specific (public) ip (11.11.11.22 , 11.11.11.23)

the docker host on 10.10.10.222.

i have subnet 11.11.11.20/27, gateway 11.11.11.21

if matters server @ softlayer.

docker-compose.yml

version: '2' services:   nginx-0:     image: nginx:1.10     ports:       - 11.11.11.22:80:80     networks:       app_net:         ipv4_address: 11.11.11.22    nginx-1:     image: nginx:1.10     ports:       - 11.11.11.23:80:80     networks:       app_net:         ipv4_address: 11.11.11.23  networks:   app_net:     driver: bridge     ipam:       driver: default       config:       - subnet: 11.11.11.20/27         gateway: 11.11.11.21 

ip a


3: eth1: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state group default qlen 1000     link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff     inet 10.10.10.222/27 brd 10.10.10.223 scope global eth1        valid_lft forever preferred_lft forever     inet 11.11.11.22/32 brd 11.11.11.22 scope global eth1:0        valid_lft forever preferred_lft forever     inet 11.11.11.23/32 brd 11.11.11.23 scope global eth1:1        valid_lft forever preferred_lft forever 

ips inside container docker exec nginx-0 ip a

6: eth0@if7: <broadcast,multicast,up,lower_up> mtu 1500 qdisc noqueue state group default     link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff     inet 11.11.11.22/27 scope global eth0        valid_lft forever preferred_lft forever 

if curl 2 ips "curl: (52) empty reply server"

any other ip in range return "failed connect..."

is there solution this?

thanks in advance! dominik

i figured out.

i had remove interface on host.

ipconfig eth0:0 down ipconfig eth0:1 down 

i removed /etc/networking/interfaces


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -