docker-compose.yml容器网络
创建容器网络
docker network create --subnet=192.168.101.0/24 backend
网络模式:
bridge
none
container
host
外部网络: flannel、calico...
version: '3'
services:
discover:
build: .
container_name: discover
restart: always
volumes:
- /data/Log:/Log
- /etc/localtime:/etc/localtime
ports:
- 1111:1111
environment:
- spring.cloud.config.profile=prod
- user.timezone=GMT+08
networks:
backend:
# aliases:
# - my-discover-net
ipv4_address: 192.168.101.10
networks:
backend:
driver: bridge
ipam:
config:
- subnet: 192.168.101.0/24
networks:
backendaa:
ipv4_address: 192.168.101.20
networks:
backendaa:
external:
name: discover_backend