【发布时间】:2020-03-19 10:29:59
【问题描述】:
我想在我的 docker 中配置我的 Trafik 安装以使用子文件夹而不是子域。我知道它应该有效,正如我已经在其他帖子中读到的那样。 但是,我不明白我做错了什么......
我的测试域中的 docker 具有 FQDN ubuntudocker.domain.qa(我还为 traefik.ubuntudocker.domain.qa 定义了别名)
这是我的撰写文件: 带有子域的设置工作得很好,但如果我在路径中使用注释掉的变体,它不会。在我的浏览器中,我只是得到“找不到路径”。
version: '3'
services:
traefik:
image: traefik:v2.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/traefik.yml:ro
- ./data/acme.json:/acme.json
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefik.ubuntudocker.domain.qa`)"
#- "traefik.http.routers.traefik.rule=Host(`ubuntudocker.domain.qa`) && Path(`/traefik`)"
- "traefik.http.routers.traefik.service=api@internal"
networks:
proxy:
external: true
还有我的 traefik.yml 设置文件:
api:
dashboard: true
log:
level: INFO
entryPoints:
http:
address: ":80"
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
非常感谢!
【问题讨论】:
标签: docker docker-compose routes traefik