无法通过traefik将流量路由到docker容器

时间:2019-03-02 21:57:00

标签: docker reverse-proxy traefik

我正尝试通过traefik将来自我的域foobar.com的流量路由到后端容器,作为反向代理。但是我看不到问题!有人可以帮忙吗?

我的traefik.toml文件如下:

debug = true

logLevel = "ERROR"

defaultEntryPoints = ["http", "https"]

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

[retry]

[docker]
  endpoint = "unix:///var/run/docker.sock"
  domain = "foobar.com"
  watch = true
  exposedByDefault = false
  network = "web"


[acme]
  email = "my-email-here@gmail.com"
  storage = "acme.json"
  entryPoint = "https"
  onHostRule = true

[acme.httpChallenge]
  entryPoint = "http"

我的docker-撰写traefik:

version: '2'                                                

    services:                                                   
      traefik:                                                  
        image: traefik:latest                                   
        restart: always                                         
        command: --docker --web                                 
        ports:                                                  
          - 80:80                                               
          - 443:443                                             
          - 8080:8080                                           
        networks:                                               
          - web                                                 
        volumes:                                                
          - /var/run/docker.sock:/var/run/docker.sock           
          - /home/dockerfiles/traefik/traefik.toml:/traefik.toml
          - /home/dockerfiles/traefik/acme.json:/acme.json      
        container_name: traefik                                 

    networks:                                                   
      web:                                                      
        external: true     

我正在尝试建立一个示例幽灵博客。 docker-compose文件如下所示:

version: '2.1'

services:

  ghost:
    image: ghost:1-alpine
    restart: always
    expose:
      - "2368"
    labels:
      - traefik.docker.network=web
      - traefik.enable=true
      - traefik.frontend.rule=Host:foobar.com
      - traefik.port=2368
      - traefik.protocol=http
      - traefik.backend=ghost
    networks:
      - web

networks:
  web:
   external: true

0 个答案:

没有答案