docker compose 文件示例:
---
version: "3.7"
services:
gmzta-docker:
image: gmzta/gmzta:latest
container_name: gmzta-docker
hostname: gmzta-docker
environment:
- GM_TOKEN=gmzta-authkey-123-456789abcdef # 替换授权密钥
- GM_CONFIG_DIR=/var/lib/gmzta
- GM_TUN=false
volumes:
- ${PWD}/gmzta-docker/state:/var/lib/gmzta
restart: unless-stopped # 设置容器重启策略,除非手动停止,否则始终尝试重启
networks:
- default
nginx-test:
image: nginx
network_mode: service:gmzta-docker
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro # 可选:自定义 Nginx 配置
networks:
default:
driver: bridge # 显式声明默认网络为桥接模式,可省略
nginx 文件示例:
server {
listen 80;
location / {
proxy_pass http://192.x.y.1:8080;
proxy_set_header Host $host;
}
}
启动容器
docker-compose up -d