Switching from labels to dynamic conf - not working

When I deploy my Docker container, which I'm having issues with, using labels, everything works as it should. But when I now wish to switch it from using labels to dynamic configuration, it doesn't work. I get a 404 error. I have other Docker containers running, and I can point to them from the dynamic configuration without any problems.

My Docker Compose file with labels looks like this:

services:
  ocis:
    image: owncloud/ocis:latest
    container_name: ocis
    restart: unless-stopped
    volumes:
      - ocis-config:/etc/ocis
      - ocis-data:/var/lib/ocis

...

    networks:
      - traefik-proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ocis.rule=Host(`files.secret-filestorage.io`)"
      - "traefik.http.routers.ocis.entrypoints=websecure"
      - "traefik.http.routers.ocis.tls=true"
      - "traefik.http.services.ocis.loadbalancer.server.port=9200"
      - "traefik.http.routers.ocis.service=ocis"

My Docker Compose file without configuration labels looks like this:

    networks:
      - traefik-proxy
    labels:
      - "traefik.enable=true"

My dynamic configuration, when I run without labels, looks like this:

http:
  routers:
    ocis:
      entryPoints: websecure
      rule: Host (`files.secret-filestorage.io`)
      service: ocis-service
      tls: {}

  services:
     ocis-service:
       loadBalancer:
         servers:
           - url: http://ocis

I deliberately omitted irrelevant configuration since nothing else has changed except for moving the configuration.

Looking at the Traefik Dashboard for the service created, the dynamically created service points to the correct IP address and port for the Docker container.

What am I missing, I wonder?

Thanks in advance!

I think entrypoints needs to be an array.

http:
  routers:
    ocis:
      entryPoints:
        - websecure
      rule: Host (`files.secret-filestorage.io`)
      service: ocis-service
      tls: {}

In labels you specify the ocis port to be used internally, in file you don’t, Traefik will use default port 80.

Enable and check Traefik log for errors.

1 Like

Aha! I actually didn't know that, and I couldn't guess it either because the service in the Traefik Dashboard showed both the desired IP address and the required port. I checked the log file, as you said, and then I could see that the request was made from port 80. Shame on me for not checking there first.

I added the port to the URL now, and it works as intended. Thank you so much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.