Hello everyone,
really banging my head on this one as I'm of the impression that this has worked not too long ago and I cannot find what change maybe destroyed functionality.
I'm playing around with microservices on my local machine and have set up multiple mongo db containers, services and web applications using docker-compose. Communication inside the created docker network is no problem, but I can no longer connect to the databases from code running on my machine or from the compass application.
Here's my traefik setup and an example configuration of a database container:
name: infra
services:
traefik:
image: traefik:latest
command:
- --api.insecure=true
- --providers.docker
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entrypoints.mongo-db.address=:27017
- --providers.file.directory=/etc/traefik/config/dynamic
- --log.level=DEBUG
ports:
- 80:80 # HTTP
- 443:443 # HTTPS
- 8080:8080 # Dashboard
- 27017:27017 # MongoDB
volumes:
- //var/run/docker.sock:/var/run/docker.sock # listen to Docker events
- ./traefik/config/dynamic:/etc/traefik/config/dynamic
- ./traefik/certs:/certs
networks:
- traefik
networks:
traefik:
external: true
name: product-configuration
services:
data:
image: mongo:latest
environment:
- MONGO_INITDB_ROOT_USERNAME=docker
- MONGO_INITDB_ROOT_PASSWORD=mongopw
volumes:
- ${DOCKER_PATHS_MONGO_BASE}\\product-configuration:/data/db
labels:
- traefik.tcp.services.data-product-configuration.loadbalancer.server.port=27017
- traefik.tcp.routers.data-product-configuration.rule=HostSNI(`product-configuration-data.traefik.local`)
- traefik.tcp.routers.data-product-configuration.entrypoints=mongo-db
- traefik.tcp.routers.data-product-configuration.service=data-product-configuration
- traefik.tcp.routers.data-product-configuration.tls=true
- traefik.tcp.routers.data-product-configuration.tls.passthrough=true
networks:
traefik:
aliases:
- product-configuration-data.traefik.local
networks:
traefik:
external: true
I'm thankful for any input on what I might be missing.