"service \"portainer-agent\" error: port is missing"

Dear community,

I am working a docker swarm project. We choose traefik to be the main point of routing http trafic to containers.

So far so good.
However, I am seeing in the logs the following message :

2025-06-18T13:41:06Z ERR github.com/traefik/traefik/v3/pkg/provider/docker/config.go:82 > error="service \"portainer-agent\" error: port is missing" container=portainer-agent-ie041q839qz7v7552ayx5a0by providerName=swarm

after some research I understand that traefik when reading service catalog from docker swarm, the port information is not provided. But In my case this service should not be exposed in anyway through traefik. This is just an internal service.

So how can I clean this log message ?
Am I missing something ?

best regards

Share your Traefik static and dynamic config, and compose file(s) if used.

Maybe you need to set traefik.enable=false label to Portainer service (doc).

Hello,

indeed I try to play with it, but didn't arrive to fix it :

For traefik :

version: "3.3"

services:
  traefik:
    image: "traefik:latest"
    command:
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.docker
      - --providers.swarm=true
      # Enables the web UI and tells Traefik to listen to docker
      - --api.insecure=true
      - --log.level=DEBUG
      - --accesslog=true  
      - --exposedByDefault=false

    ports:
      - "80:80"
      - "443:443"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    deploy:
      restart_policy:
        condition: any
      placement:
        constraints: [node.role == manager]

For the service :


version: "3.3"

networks:
  agent_network:
    driver: overlay
    attachable: true
  traefik_default:
    external: true

services:
  agent:
    image: portainer/agent:2.27.7
    environment:
      AGENT_CLUSTER_ADDR: tasks.agent
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
    networks:
      - agent_network
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]
       
volumes:
  portainer_data:

it seems that my config file was wrong, the proper key is :

- --providers.swarm.exposedbydefault=false

Now in the log I got :


2025-06-18T17:39:18+02:00 DBG github.com/traefik/traefik/v3/pkg/provider/docker/config.go:185 > Filtering disabled container container=portainer-agent-67nvlfmyxytcngob4c4z8ap52 providerName=swarm