我有以下 docker-compose 设置
services:
traefik:
image: traefik:v2.3
container_name: traefik
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik/traefik.yml:/traefik.yml
# Map the dynamic conf into the container
- ./traefik/config.yml:/etc/traefik/config.yml:ro
# Map the certificats into the container
# - ./certs:/etc/certs:ro
labels:
# Enable this container to be mapped by traefik
# For more information, see: https://docs.traefik.io/providers/docker/#exposedbydefault
- "traefik.enable=true"
# Use "traefik" router configuration defined into the dynamic config file: ./traefik/config.yml
- "traefik.http.routers.traefik=true"
app-pwa:
restart: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.routers.app-pwa.rule=Host(`pwa.example.com`)"
- "traefik.http.routers.app-pwa.tls=true"
- "traefik.http.services.app-pwa.loadbalancer.server.port=8000"
build:
context : .
dockerfile: Dockerfile-pwa
image: pwa:1.0.0
container_name: app-pwa
#volumes:
# - ./app_pwa:/var/app/
# - /var/app/node_modules
#- /var/app/.nuxt
# - /var/app/sw.js
ports:
- 8085:8000
expose:
- 8000
运行 docker-compose build
然后 docker-compose up -d
构建并启动容器,没有错误。
问题出现在尝试浏览 pwa.example.com 并且加载了之前的 app-pwa 图像应用程序时。如果我浏览 example.com:8085,则加载当前的 app-pwa 图像应用程序。执行 docker-compose restart app-pwa
或 docker system prune -f
不能解决问题。所以我猜 Traefik 是出于某种原因加载了一个旧的容器镜像。
您遇到过这个问题吗?
谢谢