amazon-ecs - 如何告诉 Traefik 在使用 AWS ECS 和 Fargate 时不要尝试连接到 docker.sock
问题描述
我正在使用 Fargate 在 AWS ECS 上为 Web 应用程序设置环境。安装程序使用多个容器作为前端和后端,并使用 Traefik(也在一个容器中)在 ALB 后面进行路由。我正在使用 ecs-cli 和 docker-compose 文件进行部署,一切正常。
尽管一切正常,但 traefik 容器仍在不断记录有关无法连接到 docker.sock 的错误
time="2019-09-12T21:54:13Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
time="2019-09-12T21:54:13Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?, retrying in 3.829225701s"
我非常了解 traefik 将无法在该环境中连接到 docker.sock,并且当我显然正确配置了ECS 提供程序时,它不需要连接到套接字。因此它仍然尝试。
traefik.toml
[entryPoints]
...
[ecs]
clusters = ["cluster-name"]
watch = true
refreshSeconds = 15
exposedByDefault = true
region = "eu-west-1"
domain = "ecs.domain"
[retry]
码头工人-comopse.yml
version: "3"
services:
proxy:
image: ${custom-image-with-toml-baked-in}
command: --api --docker
ports:
- "80:80"
- "443:443"
- "8080:8080"
labels:
- "traefik.enable=true"
- "traefik.backend=traefik"
- "traefik.frontend.rule=Host:traefik.ecs.domain"
- "traefik.port=8080"
logging:
driver: awslogs
...
...
因此,正如我所提到的,看起来 Traefik 仍想连接到 docker.sock,而我无法找到告诉 Traefik 仅依赖 ECS 的方法。
解决方案
因此,在查看我的问题时,我仔细检查了command: --api --docker
docker-compose 文件中的行,结果发现错误来自--docker
选项...
此行是早期简单 docker 部署的遗留内容,因此删除此选项对我有用。
码头工人-compose.yml
version: "3"
services:
proxy:
image: ${custom-image-with-toml-baked-in}
command: --api
ports:
- "80:80"
- "443:443"
- "8080:8080"
labels:
- "traefik.enable=true"
- "traefik.backend=traefik"
- "traefik.frontend.rule=Host:traefik.ecs.domain"
- "traefik.port=8080"
logging:
driver: awslogs
...
...
所以万一有人遇到同样愚蠢的问题,我希望这个独白能有所帮助。
推荐阅读
- flutter - 用户在 Flutter 中杀死应用程序后是否有任何功能或程序可以播放声音
- graph - 对于 V 循环中的每个 u,v 是否与 V 成线性关系?
- kubernetes - Kubernetes nginx-ingress - 记录流量
- javascript - i am using axios to get data to display in the page but what is displayed is object promise not value
- graphql - How do I present authorization details in my GraphQL schema?
- php - Getting Max Boolean clause error solr 6.2.1
- python - Python Flask could not add new user instead of it display else part message
- cassandra - ReadTimeout in cqlsh console of cassandra
- github - 如果项目在github上开源,我可以复制代码吗?
- android - How to handle fragment state using viewmodel?