Hello together,
I am still a big beginner with Traefik. I'm currently trying to boot a construct (first without encryption to be able to start it). Unfortunately the service doesn't seem to find the URL of the container.
Briefly a little background:
I'm running Traefik as a Docker container. Further projects / websites I will put on the server as own Docker-Compose, and start them up. These should register with Traefik and thus be accessible.
I have created a shared network "proxy" on the server in advance.
My configuration for Traefik looks like this:
providers:
docker:
exposedByDefault: false
watch: true
allowEmptyServices: true
network: proxy
useBindPortIP: true
log:
filePath: "/etc/traefik/logs/log-file.log"
level: "ERROR"
api:
dashboard: true
insecure: true
## Static configuration
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
certificatesResolvers:
lets-encrypt:
acme:
email: kontakt@localhost
storage: acme.json
httpChallenge:
entryPoint: web
My Docker Compose for Traefik:
version: '3'
services:
reverse-proxy:
image: traefik
container_name: "traefik"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik:/etc/traefik
labels:
- traefik.enable=true
- traefik.http.routers.traefik.rule=Host(`traefik.localhost`)
# - traefik.http.routers.traefik.tls.certresolver=lets-encrypt
- traefik.http.routers.traefik.service=traefik@docker
- traefik.http.services.traefik.loadbalancer.server.port=8080
- traefik.http.services.traefik.loadbalancer.server.url=http://traefik:8080
networks:
- proxy
- default
networks:
proxy:
external: true
default:
driver: bridge
The config for Docker Compose:
My separate service that is unreachable as Docker Compose:
version: '3'
services:
mvo-web:
build:
context: .
args:
PORT: ${WEB_PORT}
restart: unless-stopped
container_name: "mvo-web"
labels:
- traefik.enable=true
- traefik.http.routers.mvo-web.rule=Host(`neu.localhost`)
# - traefik.http.routers.mvo-web.tls.certresolver=lets-encrypt
- traefik.http.routers.mvo-web.service=mvo-web@docker
- traefik.http.services.mvo-web.loadbalancer.server.port=${WEB_PORT}
- traefik.http.services.mvo-web.loadbalancer.server.url=http://mvo-web:${WEB_PORT}
ports:
- ${WEB_PORT}:${WEB_PORT}
env_file: .env
environment:
PORT: ${WEB_PORT}
NODE_ENV: ${NODE_ENV}
volumes:
- ./:/opt/app
networks:
- proxy
- default
mvo-api:
build:
context: container/cms/.
args:
PORT: ${API_PORT}
image: strapi:latest
restart: unless-stopped
container_name: "mvo-api"
labels:
- traefik.enable=true
- traefik.http.routers.mvo-api.rule=Host(`api.localhost`)
# - traefik.http.routers.mvo-api.tls.certresolver=lets-encrypt
- traefik.http.routers.mvo-api.service=mvo-api@docker
- traefik.http.services.mvo-api.loadbalancer.server.port=${API_PORT}
- traefik.http.services.mvo-api.loadbalancer.server.url=http://mvo-api:${API_PORT}
ports:
- ${API_PORT}:${API_PORT}
env_file: .env
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
DATABASE_HOST: ${DATABASE_HOST}
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
JWT_SECRET: ${JWT_SECRET}
ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
APP_KEYS: ${APP_KEYS}
NODE_ENV: ${NODE_ENV}
PORT: ${API_PORT}
volumes:
- ./container/cms/config:/opt/app/config
- ./container/cms/public:/opt/app/public
- ./container/cms/src:/opt/app/src
- ./container/cms/extensions:/opt/app/extensions
- ./container/cms/.env:/opt/app/.env
- ./container/cms/package.json:/opt/app/package.json
networks:
- proxy
- default
mvo-db:
container_name: "mvo-db"
platform: linux/amd64
restart: unless-stopped
env_file: .env
image: mariadb:latest
environment:
MYSQL_USER: ${DATABASE_USERNAME}
MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
MYSQL_PASSWORD: ${DATABASE_PASSWORD}
MYSQL_DATABASE: ${DATABASE_NAME}
volumes:
- strapi-data:/var/lib/mysql
- ./container/db:/var/lib/mysql
ports:
- ${DATABASE_PORT}:${DATABASE_PORT}
networks:
- default
volumes:
strapi-data:
networks:
proxy:
external: true
default:
driver: bridge
Screenshot as seen in Traefik.
I've been looking for a solution for days now. Unfortunately, nothing could really help so far and I hope here for a solution.