docker 容器大佬请进
我们知道 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.comacme.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 我看看 - /var/run/docker.sock:/var/run/docker.sockhttps://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif 并不是,这句才是可以控制的关键,
- /var/run/docker.sock:/var/run/docker.sock 用一下 Watchtower
你就懂了 https://www.freebuf.com/articles/system/201793.html
:lol https://github.com/madwind/docker-nginx 我也写了个集成acme的,caddy太难用了,还是nginx好 我直接用的caddy,挺简单
页:
[1]