创建一个外部网络

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
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐