Docker Compose
更新时间:2023-02-22 15:57:53标签:docker
示例
1version: "3.9"2services:3 nginx:4 image: nginx:1.22-alpine5 container_name: nginx6 volumes:7 - ./nginx/nginx.conf:/etc/nginx/nginx.conf8 - static:/var/www/static:ro9 ports:10 - "80:80"11 restart: always12volumes:13 static:14networks:15 # default代表所有服务的默认网络16 default:17 # 网络名称18 name: network-name19 # 网络模式,默认为bridge(所有模式:bridge、host、overlay、macvlan以及none)20 driver: bridge21 # 网络管理22 ipam:23 driver: default24 config:25 # 指定子网网段26 - subnet: 172.58.0.0/16