1.docker-compose.yaml配置示例
services:
my-nginx:
image: nginx:latest
hostname: "my-nginx"
container_name: nginx
environment:
- TZ=Asia/Shanghai
ports:
- 8080:8080
volumes:
- ./nginx/html:/usr/share/nginx/html
# 挂载外部配置
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
# 挂载日志
- ./nginx/logs:/var/log/nginx
privileged: true
restart: always
network_mode: "host"