【发布时间】:2022-01-13 16:43:39
【问题描述】:
我是一个完整的码头工人菜鸟。刚刚按照教程安装了 docker 和 docker-compose 以及 portainer。
现在我想在 portainer 上设置 traefik 反向代理。
这是 /etc/traefik 中的 traefik.yml 文件
global:
checkNewVersion: true
sendAnonymousUsage: false # true by default
# (Optional) Log information
# ---
# log:
# level: ERROR # DEBUG, INFO, WARNING, ERROR, CRITICAL
# format: common # common, json, logfmt
# filePath: /var/log/traefik/traefik.log
# (Optional) Accesslog
# ---
# accesslog:
# format: common # common, json, logfmt
# filePath: /var/log/traefik/access.log
# (Optional) Enable API and Dashboard
# ---
api:
dashboard: true # true by default
insecure: true # Don't do this in production!
# Entry Points configuration
# ---
entryPoints:
web:
address: :80
# (Optional) Redirect to HTTPS
# ---
# http:
# redirections:
# entryPoint:
# to: websecure
# scheme: https
websecure:
address: :443
# Certificates configuration
# ---
# TODO: Custmoize your Cert Resolvers and Domain settings
#
这是 docker-compose 文件:
version: '3'
volumes:
traefik-ssl-certs:
driver: local
services:
traefik:
image: "traefik:v2.5"
container_name: "traefik"
ports:
- "80:80"
- "443:443"
# (Optional) Expose Dashboard
- "8080:8080" # Don't do this in production!
volumes:
- /etc/traefik:/etc/traefik
- traefik-ssl-certs:/ssl-certs
- /var/run/docker.sock:/var/run/docker.sock:ro
但是当我尝试启动容器时,我得到了这个错误:
2021/12/08 18:08:07 命令 traefik 错误:yaml:第 19 行:没有找到预期的密钥
当我从 docker-compose 文件中删除“服务”下的整个“卷”部分时,我可以让容器运行,但我需要它来设置我的 traefik。我不知道我做错了什么,因为我正在关注这个 1:1 的视频教程
【问题讨论】:
标签: docker docker-compose dockerfile portainer