Traefik in docker-compose loads an old docker image

  docker, docker-compose, traefik

I have the following docker-compose setup

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

Running docker-compose build and then docker-compose up -d builds and starts containers with no errors.

The problem comes when trying to browse pwa.example.com and the previous app-pwa image app is loaded. If I browse example.com:8085 the current app-pwa image app is loaded. Doing docker-compose restart app-pwa or docker system prune -f doesn’t fix the problem. So I guess Traefik is for whatever reason loading an old container image.

Have you ever experienced this problem ?

Thanks

Source: Docker Questions

LEAVE A COMMENT