I have the following docker-compose setup. I have two nginx containers that are connected with
traefik. The one labeled with foobar.test
works, the one labeled with foobar.test && pathPrefix /admin
doesn't work most of the time. Sometimes it works, but most of the time after bringing the containers down and back up it doesn't work anymore.
version: '3.7'
services:
traefik:
image: traefik:v2.0
command: --api.insecure=true --providers.docker --providers.docker.exposedByDefault=false
ports:
- '80:80'
- '8080:8080'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- proxy
mysql:
container_name: mysql
image: mysql:8.0.19
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_ROOT_PASSWORD=$DB_PASSWORD
ports:
- 3306:3306
volumes:
- mysql_data:/var/lib/mysql
networks:
- mysql
client:
image: nginx:1.17.10-alpine
volumes:
- ./client/public:/usr/share/nginx/html
labels:
- traefik.http.routers.foobar_client.rule=Host(`foobar.test`)
- traefik.enable=true
networks:
- proxy
admin_nginx:
build:
context: ./admin
dockerfile: ./docker/nginx/Dockerfile.dev
volumes:
- ./admin/public:/app/public
networks:
- proxy
- admin
labels:
- traefik.http.routers.foobar_admin.rule=Host(`foobar.test`) && PathPrefix(`/admin`)
- traefik.enable=true
admin_php-fpm:
container_name: php-fpm
build:
context: ./admin
dockerfile: ./docker/php-fpm/Dockerfile.dev
volumes:
- ./admin:/app
networks:
- admin
- mysql
networks:
proxy:
name: proxy
driver: bridge
mysql:
name: mysql
driver: bridge
admin:
name: admin
driver: bridge
volumes:
mysql_data:
name: mysql_data
Any ideas what I'm doing wrong? Thnx in advance!