3

我有一个生成 ACME 证书的 Traefik 反向代理,我想在我的 docker 容器上启用 SSL。

在我的容器中,我有一个自签名证书,但 Traefik 拒绝连接到它。

的 docker-compose.yml

version: "2"
services:
  magento:
    image: lavoweb/php-5.6
    expose: 
     - 80
     - 443
    volumes:
     - ./data/src/:/var/www/html
    labels:
     - "traefik.port=80"
     - "traefik.backend=swarm"
     - "traefik.protocol=https"
     - "traefik.frontend.rule=Host:1.swarm.lavoweb.net"
     - "traefik.docker.network=web"
    networks:
     - web
     - internal
networks:
  web:
    external:
      name: web
  internal:
    driver: bridge

我收到了这个错误:

内部服务器错误

4

1 回答 1

3

这就是我设法使用 Docker Swarm 和 Docker Compose V3 与 LetsEncrypt 自动更新一起工作的方法:

version: '3'
services:
  traefik:
    image: traefik
    command: --web --docker --docker.domain=docker.localhost --docker.watch \
      --logLevel=DEBUG \
      --defaultEntryPoints='http,https' \
      --entryPoints='Name:http Address::80' \
      --entryPoints='Name:https Address::443 TLS' \
      --docker.swarmmode=true \
      --docker.exposedbydefault=false \
      --acme \
      --acme.entryPoint='https' \
      --acme.email='sugarcane@gmail.com' \
      --acme.ondemand=false \
      --acme.acmelogging=true \
      --acme.onhostrule=true \
      --acme.storage='/etc/traefik/acme/acme.json'
    networks:
      - default
      - traefik-net
    ports:
      - "80:80"
      - "8080:8080"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - traefikdata:/etc/traefik/acme

  mytestservice:
    image: blah/mytestservice
    networks:
      - default
      - traefik-net
    ports:
      - "8001:80"
    deploy:
      labels:
        - "traefik.port=80"
        - "traefik.enable=true"
        - "traefik.backend=machine-mytestservice"
        - "traefik.docker.network=traefik-net"
        - "traefik.frontend.rule=Host:mydomain.com,www.mydomain.com"

networks:
  traefik-net:

volumes:
  traefikdata:
于 2017-05-06T04:19:00.363 回答