Docker Community Forums

Share and learn in the Docker community.

Traefik Service not working in swarm mode

Hello Forum

I have following environment.
Three docker server working in swarm mode. All three Server are Swarm Manager.

Now I have the problem, that traefik doesn’t create any services. To manage docker i use portainer. There I created a traefik and a joomla Stack. The joomla stack save the files to a shared NAS volume:

  • /opt/docker/joomla/web for joomla webfiles (see the joomla stack below)
  • /opt/docker/joomla/db:/var/lib/mysql for mysql files (see the joomla stack below)

Unfortunatelly the joomla stack is not shown in the traefik web services

The configuration files are following:

###################################################################

traefik.toml

################################################################

Ping configuration

################################################################

Enable ping

[ping]

Name of the related entry point

Optional

Default: “traefik”

entryPoint = “traefik”

################################################################

Docker configuration backend

################################################################

Enable Docker configuration backend

[providers.docker]

Docker server endpoint. Can be a tcp or a unix socket endpoint.

Required

Default: “unix:///var/run/docker.sock”

endpoint = “tcp://10.10.10.10:2375”

Default host rule.

Optional

Default: “Host({{ normalize .Name }})”

defaultRule = “Host({{ normalize .Name }}.docker.localhost)”

Expose containers by default in traefik

Optional

Default: true

exposedByDefault = false
watch = true
swarmMode = true
network = “traefik”

###################################################################

Traefik stack

version: ‘3.7’
services:
traefik:
image: traefik:latest
command: --docker.domain=mydom.local
ports:
- 80:80
- 443:443
- 8080:8080
networks:
- traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/docker/traefik/traefik.toml:/traefik.toml
# - /opt/docker/traefik/acme.json:/acme.json
deploy:
labels:
- “traefik.backend=traefik”
- “traefik.frontend.rule=Host:traefik.mydom.local”
- “traefik.port=8080”
container_name: traefik
restart: always

networks:
traefik:

###################################################################

Joomla stack
version: “3.7”

services:
joomla:
image: joomla
restart: always
links:
- joomladb:mysql
#ports:
#- 8090:80
volumes:
- /opt/docker/joomla/web:/var/www/html
environment:
JOOMLA_DB_HOST: joomladb
JOOMLA_DB_PASSWORD: mypassword
networks:
- Traefik_default
- stack_intern
deploy:
labels:
- “traefik.enable=true”
- “traefik.docker.network=Traefik_default”
- “traefik.http.routers.joomla.rule=Host(joomla.mydom.local)”
- “traefik.http.routers.joomla.entrypoints=web”
- “traefik.http.routers.joomla.tls=false”
- “traefik.http.services.joomla.loadbalancer.server.port=80”
- “traefik.http.services.joomla.loadbalancer.server.scheme=http”
joomladb:
image: mysql:5.6

ports:

  #- 3306
restart: always
environment:
  MYSQL_DATABASE: joomladb
  MYSQL_USER: root
  MYSQL_ROOT_PASSWORD: mypassword
volumes:
   - /opt/docker/joomla/db:/var/lib/mysql
networks:
   - stack_intern

networks:
stack_intern:
Traefik_default:
external: true

As you can see, the joomla services are missing here. In simple container mode it worked. But not in swarm mode.

Can someone help me to solve this problem? It seem that there are multiple problems. I can’t reach joomla, maybe this is a name resolution error and traefik services are not created.

Thanks in advance for your help