Docker Community Forums

Share and learn in the Docker community.

Mysql on Swarm with Traefik and shared container store

Hello Forum

I have following environment.

Three docker server. These three servers runs with docker swarm, all three in manager mode.
Additional i mounted a NAS volume. On this NAS volume all container are stored. I mean, all three servers are sharing this volume
Then I installed also traefik reverse proxy that is also storing the informations on this NAS shared volume.

My last step was to install Joomla with its Mysql database. And here I get some troubles. I’m not able to connect to the mysql database on the shared NAS volume.

Can someone help me to solve this problem?

/opt/docker/joomla/db is the shared NAS volume for joomla database
/opt/docker/joomla/web is the shared NAS volueme for joomla web

Here my stacks.

For Traefik

version: ‘3.7’
services:
traefik:
image: traefik:latest
command: --docker.domain=mydomain.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
# labels:
# - “traefik.frontend.rule=Host:traefik.mydomain.local”
# - “traefik.port=8080”
container_name: traefik
restart: always

networks:
traefik:
external: true

For Joomla

version: “3.7”

services:
joomla:
image: joomla
restart: always
depends_on:
- database
ports:
- 8090:80
volumes:
- /opt/docker/joomla/web:/var/www/html
environment:
JOOMLA_DB_HOST: 172.16.238.10:3306
JOOMLA_DB_PASSWORD: mypassword
networks:
- traefik
- stack_intern
deploy:
labels:
- “traefik.enable=true”
- “traefik.docker.network=traefik”
- “traefik.http.routers.joomla.rule=Host(joomla.lustrati.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
restart: always
hostname: joomladb
environment:
MYSQL_ROOT_PASSWORD: mypassword
MYSQL_ROOT_HOST: “%”
volumes:
- /opt/docker/joomla/db:/var/lib/mysql
networks:
stack_intern:
ipv4_address: 172.16.238.10
aliases:
- database

networks:
stack_intern:
ipam:
driver: default
config:
- subnet: “172.16.238.0/24”
traefik:
external: true