docker-compose 配置 容器 访问本地网络

版权声明:转载请注明出处,谢谢 https://blog.csdn.net/github_38877986/article/details/85259937

创建一个外部网络

docker network create outside

配置如下:

version: '3.3'
services:
  php:
    build: ./docker/php
    working_dir: /data
    volumes:
      - .:/data
      - ./docker/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf:ro
    networks:
      - default
      - outside
  nginx:
    image: nginx
    volumes:
      - .:/data
      - ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
    ports:
      - 80:80
    networks:
      - default
    command: [nginx, '-g', 'daemon off;']

networks:
  outside:
    external: true

猜你喜欢

转载自blog.csdn.net/github_38877986/article/details/85259937
今日推荐