|
我们知道 2 个容器之间一般是隔离的
但是最近用 acme.sh 的时候看见 acme.sh 容器竟然能控制另一个 nginx 容器里面的服务重启
service nginx force-reload
貌似通过 labels 实现的,自己编排镜像应该怎么写呢?
https://github.com/acmesh-offici ... ker-compose-example
- version: '3.4'services: web: image: nginx container_name: nginx labels: - sh.acme.autoload.domain=example.com acme.sh: image: neilpang/acme.sh container_name: acme.sh command: daemon volumes: - ./acmeout:/acme.sh - /var/run/docker.sock:/var/run/docker.sock environment: - DEPLOY_DOCKER_CONTAINER_LABEL=sh.acme.autoload.domain=example.com - DEPLOY_DOCKER_CONTAINER_KEY_FILE=/etc/nginx/ssl/example.com/key.pem - DEPLOY_DOCKER_CONTAINER_CERT_FILE="/etc/nginx/ssl/example.com/cert.pem" - DEPLOY_DOCKER_CONTAINER_CA_FILE="/etc/nginx/ssl/example.com/ca.pem" - DEPLOY_DOCKER_CONTAINER_FULLCHAIN_FILE="/etc/nginx/ssl/example.com/full.pem" - DEPLOY_DOCKER_CONTAINER_RELOAD_CMD="service nginx force-reload"
复制代码
学习了,/var/run/docker.sock:/var/run/docker.sock ,才是关键,以下是参考资料:
https://docs.docker.com/engine/r ... ockerd/#description
https://cloud.tencent.com/developer/article/1454335 |
|