Hello,
I'm having problems to forward requests when container has more than one network.
In the docker-compose file, I create 2 networks: frontend for apps and backend for database. The container that is causing me problems is the dspace that has the 2 networks. When I leave only the frontend network the routing of the traefik works.
I've tried using the options "providers.docker.network=frontend" and "traefik.docker.network=frontend" but still don't work.
docker-compose.yml
#################################################################################
version: "3.7"
services:
traefik:
image: "traefik:v2.2"
container_name: "traefik"
command:
# - "--log.level=DEBUG"
#- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--api.dashboard=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=frontend"
- "--accesslog=true"
- "--accesslog.filepath=/tmp/acceess.log"
- "--log.level=DEBUG"
- "--log.filePath=/tmp/traefik.log"
- "--log.format=json"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.local`)"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.middlewares=traefik-auth"
- "traefik.http.middlewares.traefik-auth.basicauth.users=admin:$$apr1$$bJwG68Gg$$JWru9HMqsduYytGNpr6rO."
- "traefik.port=8080"
ports:
- "80:80"
- "9090:8080"
networks:
- frontend
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/etc/localtime:/etc/localtime:ro"
#################################################################################
site:
image: httpd:2.4-alpine
container_name: site
restart: on-failure
ports:
- "70:80"
labels:
- "traefik.enable=true"
- "traefik.http.routers.site.rule=Host(site.lmts.com.br
)"
- "traefik.http.routers.site.entrypoints=web"
- "providers.docker.network=frontend"
networks:
- frontend
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
- "site:/var/www/html"
####################################################################################
dspacedb:
image: dspace/dspace-postgres-pgcrypto
# Note that a separate image exists for DSpace 4x
# image: dspace/dspace-postgres-4x
container_name: dspacedb
environment:
- PGDATA=/pgdata
volumes:
- pgdata:/pgdata
- "./dspace/add-ons/dspace-docker-tools:/dspace-docker-tools"
networks:
- backend
tty: true
stdin_open: true
dspace:
image: "{DOCKER_OWNER:-dspace}/dspace:{DSPACE_VER:-dspace-6_x-jdk8-test}"
container_name: dspace
environment:
# - JAVA_OPTS=
# The following memory allocation will be appended to any JAVA_OPTS settings
# - JAVA_MEM=-Xmx2500m
- SCRIPTVER=6
- DSPACE_INSTALL=/dspace
- ADMIN_EMAIL={ADMIN_EMAIL:-test@test.edu}
- ADMIN_PASS={ADMIN_PASS:-admin}
- ADMIN_FNAME={ADMIN_FNAME:-AdminFirst}
- ADMIN_LNAME={ADMIN_LNAME:-AdminLast}
- AIPZIP={AIPZIP:-https://github.com/DSpace-Labs/AIP-Files/raw/master/dogAndReport.zip}
# export SKIPAIP=Y
- SKIPAIP={SKIPAIP:-N}
# Number of sec to wait before attempting AIP ingest
- AIPWAIT=5
# Number of sec to wait before attempting to start tomcat
- DBWAIT=0
# Env vars with double underbars in names will be replaced with periods and written to local.cfg
# The defaul values for local.cfg will be provided here
# D -> -
# P -> .
- dspace__P__dir=/dspace
- db__P__url=jdbc:postgresql://dspacedb:5432/dspace
- dspace__P__hostname=localhost
- dspace__P__baseUrl=http://dspace.lmts.com.br
- dspace__P__name=DSpace Started with Docker Compose
labels:
- "traefik.http.routers.dsapce.rule=Host(dspace.lmts.com.br
)"
- "traefik.http.routers.dspace.entrypoints=web"
- "traefik.port=8080"
- "traefik.enable=true"
- "traefik.http.services.dspace.loadbalancer.server.port=8080"
- "providers.docker.network=frontend"
- "traefik.docker.network=frontend"
ports:
- 8888:8080
volumes:
- "assetstore:/dspace/assetstore"
- "./dspace/add-ons/dspace-docker-tools:/dspace-docker-tools"
- "./dspace/add-ons/mirage2/xmlui.xconf:/dspace/config/xmlui.xconf"
- "solr_authority:/dspace/solr/authority/data"
- "solr_oai:/dspace/solr/oai/data"
- "solr_search:/dspace/solr/search/data"
- "solr_statistics:/dspace/solr/statistics/data"
- "dspace_config:/dspace/config/"
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
entrypoint: /dspace-docker-tools/ingestAIP.sh
networks:
- frontend
- backend
depends_on:
- dspacedb
tty: true
stdin_open: true
####################################################################################
volumes:
site:
pgdata:
assetstore:
solr_authority:
solr_oai:
solr_search:
solr_statistics:
dspace_config:
networks:
frontend:
backend: