# Cannot enable swarmMode

**URL:** <https://community.traefik.io/t/cannot-enable-swarmmode/21767>\
**Category:** Traefik v2\
**Tags:** docker-swarm\
**Created:** [March 6, 2024, 11:21pm UTC](https://community.traefik.io/t/cannot-enable-swarmmode/21767 "2024-03-06T23:21:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eellsworth](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@eellsworth](https://community.traefik.io/u/eellsworth)\
**Post date:** [March 6, 2024, 11:21pm UTC](https://community.traefik.io/t/cannot-enable-swarmmode/21767/1 "2024-03-06T23:21:28Z")

</div>

Hi. I am trying to get Traefik to recognize containers running swarm mode.  
I am able to successfully run Traefik in docker without swarm mode using this traefik.yml file

```auto
api:
  dashboard: true

entryPoints:
  web:
    address: ":80"
# http:
# redirections:
# entryPoint:
# to: websecure

  websecure:
    address: ":443"
    http:
      middlewares:
        - secureHeaders@file
      tls:
        certResolver: letsencrypt

log:
  filePath: "/etc/traefik/traefik.log"

providers:
# swarm:
# endpoint: "unix:///var/run/docker.sock"
  docker:
    endpoint: "unix:///var/run/docker.sock"
# swarmMode: true
    exposedByDefault: false
  file:
    filename: /configurations/dynamic.yml

certificatesResolvers:
  letsencrypt:
    acme:
      email: xxxxxxxxx@gmail.com
      storage: acme.json
      keyType: EC384
      httpChallenge:
        entryPoint: web

```

and this docker-compose file:

```auto
version: "3.8"

services:
  traefik:
    image: "traefik:2.11.0"
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - "no-new-privileges:true"
    networks:
      - traefik_attachable
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik.yml:/traefik.yml:ro"
      - "./traefik.log:/etc/traefik/traefik.log"
      - "./acme.json:/acme.json"
      - "./configurations:/configurations"
    deploy:
      placement:
        constraints:
          - node.role == manager
      labels:
        - traefik.enable=true
        - traefik.docker.network=traefik_attachable
        - traefik.http.routers.traefik-secure.entrypoints=websecure
        - traefik.http.routers.traefik-secure.rule=Host(`traefik-server`)
        - traefik.http.routers.traefik-secure.service=api@internal
        - traefik.http.routers.traefik-secure.middlewares=user-auth@file

networks:
  traefik_attachable:
    external: true

```

where the traefik\_attachable network is a previously defined overlay network in my swarm. For standard docker-compose, I de-indent the labels, where as for docker stack deploy they are indented under the deploy header. In non-swarm mode Traefik can detect containers started locally on the docker server via docker-compose but it cannot detect any containers that were started via docker stack deploy.

However, when I uncomment swarmMode: true, the container runs and the browser receives the self-signed certificate but the dashboard:  
[https://traefik-server/dashboard/](https://traefik-server/dashboard/)  
returns a 404.  
When swarmMode: true is on, the log file this entry:

```auto
time="2024-03-06T23:16:58Z" level=error msg="Skip container : field not found, node: enable: true" providerName=docker

```

I think that the label enable: true is coming from the docker-compose file. However, indenting the labels under the deploy: header does not solve the problem - neither docker-compose nor docker stack deploy makes the container run properly.  
I cannot figure out how to get past this - I've read most of the pages that contain "skip container" or "field not found, enable: true" and it seems like what I'm doing should work.  
Any ideas on what is wrong would be most appreciated.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [March 7, 2024, 5:47am UTC](https://community.traefik.io/t/cannot-enable-swarmmode/21767/2 "2024-03-07T05:47:15Z")

</div>

Compare to [simple Traefik Swarm example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-swarm-traefik).

---

<div class="post-metadata">

**Author:** ![eellsworth](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@eellsworth](https://community.traefik.io/u/eellsworth)\
**Post date:** [March 7, 2024, 5:13pm UTC](https://community.traefik.io/t/cannot-enable-swarmmode/21767/3 "2024-03-07T17:13:25Z")

</div>

Thank you. I will try deploy: mode: global to see if it works.

Also, it looks like you are putting the traefik configuration into the command section, while I am mounting in a traefik.yml file and putting the configuration there. Do you know if this makes a difference?

---

<div class="post-metadata">

**Author:** ![eellsworth](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@eellsworth](https://community.traefik.io/u/eellsworth)\
**Post date:** [March 7, 2024, 5:17pm UTC](https://community.traefik.io/t/cannot-enable-swarmmode/21767/4 "2024-03-07T17:17:12Z")

</div>

Also, do you deploy this with docker compose up or docker stack deploy?

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [March 7, 2024, 5:44pm UTC](https://community.traefik.io/t/cannot-enable-swarmmode/21767/5 "2024-03-07T17:44:40Z")

</div>

As far as I know you need to use `docker stack deploy` if you want to run services on multiple nodes with a compose file.
