Docker Community Forums

Share and learn in the Docker community.

Access all subnet hosts from docker container


(Mudgilg) #1

I am new to docker container , have been able to successfully create a docker container image that install all dependancies and expose port 80 of web server i.e. apache , and localhost port 80 is mapped to port 80 of container. Now when I check http://localhost I am able to see the response.

Now next step is I have VPC configured on AWS and two subnets configured under VPC. My application will be talking to different backend servers like database/search engine/cache layer under both subnets.

I need to detailed document , how networking works in docker. I can create a docker network like following

docker network create -d bridge --subnet 192.168.0.0/24 --gateway 192.168.0.1 dockernet

this command create a docker network with subnet 192.168.0.0/24 but In my case I have two different subnets so how to configure docker network in my situation and will --gateway will always have the private IP of underlying host?