1. 程式人生 > >docker-compose 配置 容器 訪問本地網路

docker-compose 配置 容器 訪問本地網路

建立一個外部網路

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