Docker Community Forums

Share and learn in the Docker community.

Docker Network Existing

docker

(D3nsenpai) #1

Hi all,

i’m new with docker compose, and i’ve a question…

i got 2 docker compose… one for web1 and another one for web2 …
here my setting docker compose web1 :
version: “2”

services:
codigo:
container_name: asiangames
build:
context: .
dockerfile: Dockerfile
ports:
- “80:80”
- “443:443”
networks:
docker0:
ipv4_address: 17.10.0.2
cpu_shares: 50
mem_limit: 1000000000
restart: always

networks:
docker0:
driver: bridge
external: true
ipam:
config:
- subnet: 17.10.0.0/16
gateway: 17.10.0.1

and the question is, how can i use the network as like web1 in web2, so web2 is same subnet with web1?

here my docker compose web2:
version: “2”

services:
nginx:
container_name: cucunguk
build:
context: .
dockerfile: .docker/nginx.local.dockerfile
volumes:
- .docker/env:/opt/www
working_dir: /opt/www
ports:
- “81:80”
- “443:443”

Thanks!!