docker-compose1

version: '2'
services:
  web:
    image: laravel
    restart: always
    networks:
      - app_net
    ports:
      - "80:8080"

networks:
  app_net:
    external: true

docker-compose2

version: '2'
services:
  db:
    image: mysql
    restart: always
    networks:
      - app_net
    ports:
      - "80:8080"

networks:
  app_net:
    external: true

这样就能使用两个docker-compose 使用同一个网络了,
但要注意的是,app_net网络需要手动创建,在运行docker-compose之前运行

docker network create app_net