0

我尝试在一个简单的容器中使用带有 traefik 的 caddy 服务器。不幸的是Gateway Timeout,当我访问域时出现错误。我不明白错误是由于 traefik 还是我的容器造成的。

我的码头工人撰写文件:

version: '2'
#
# [ server stack ]
#
services:
    web:
        image: abiosoft/caddy
        container_name: caddy
        restart: unless-stopped
        networks:
            - caddy_network
        ports:
            - 2015:2015
        volumes:
            # app
            - ./localhost:/srv
            # configs
            - ./config/Caddyfile:/etc/Caddyfile
        labels:
            - "traefik.frontend.rule=Host:domain.com"
            - "traefik.port=2015"
            - "traefik.backend=domain.com"
            - "traefik.frontend.entryPoints=http,https"
            - "traefik.enable=true"
#
# [ networks definition ]
#
networks:
    caddy_network:
            driver: bridge

我的球童档案:

0.0.0.0:2015
browse
gzip
log stdout
errors stderr

有关信息,让我们加密证书是由 traefik 完美生成的。

任何想法?会不会是端口配置的问题?

[编辑] traefik 配置:

################################################################
# Global configuration
################################################################
defaultEntryPoints = ["http", "https"]
logLevel = "DEBUG"

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

[acme]
email = "admin@domain.com"
storageFile = "/etc/traefik/acme/acme.json"
entryPoint = "https"
OnHostRule = true
onDemand = true

[[acme.domains]]
  main = "domain.com"
  sans = ["docker.domain.com", "traefik.domain.com"] 

################################################################
# Web configuration backend
################################################################

[web]
address = ":8080"

# MD5
[web.auth.basic]
users = ["admin:xxx"]

################################################################
# Docker configuration backend
################################################################

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "traefik.domain.com"
watch = true
# Tous les conteneurs seront utilisables par Traefik
# Pour qu'il ne le soit pas, il est nécessaire d'ajouter le label "traefik.enable=false" 
# lors de la création du conteneur
exposedbydefault = false

预先感谢您的帮助。

jB

4

2 回答 2

0

工作解决方案:

version: '2'
#
# [ server stack ]
#
services:
    web:
        image: abiosoft/caddy
        container_name: caddy
        restart: unless-stopped
        networks:
            - traefik_network
        ports:
            - 2015:2015
        volumes:
            # app
            - ./localhost:/srv
            # configs
            - ./config/Caddyfile:/etc/Caddyfile
        labels:
            - "traefik.frontend.rule=Host:domain.com"
            - "traefik.port=2015"
            - "traefik.backend=domain.com"
            - "traefik.frontend.entryPoints=http,https"
            - "traefik.enable=true"
            - "traefik.docker.network=traefik_network"
#
# [ networks definition ]
#
networks:
    traefik_network:
        external: true
于 2017-08-29T04:38:12.527 回答
0

不需要打开该容器中的端口,我的意思是这一行,没有必要也不推荐:ports: - 2015:2015

于 2019-08-16T10:38:30.900 回答