Closed giuseppeiannelli closed 4 years ago
Hi,
I setup two network: frontend and backend into docker-compose.yml
version: '2.3' networks: backend: frontend: volumes: varlibldap: driver: local etcldapslapdd: driver: local varwwwphpldapadmin: driver: local services: traefik: image: traefik:2.2 networks: frontend: ports: - "80:80" - "8080:8080" - "443:443" command: - "--api.insecure=true" - "--accesslog=true" - "--providers.docker.exposedByDefault=false" - "--entryPoints.http.address=:80" - "--entryPoints.https.address=:443" - "--log.level=DEBUG" - "--providers.docker" - "--providers.docker.network=frontend" volumes: - /var/run/docker.sock:/var/run/docker.sock ldap: image: osixia/openldap:1.3.0 hostname: ldap.docker.local networks: backend: environment: LDAP_ORGANISATION: "ACME Inc." LDAP_DOMAIN: "corp.acme.com" LDAP_ADMIN_PASSWORD: "JonSn0w" LDAP_TLS: 'true' volumes: - varlibldap:/var/lib/ldap - etcldapslapdd:/etc/ldap/slapd.d phpldapadmin: image: osixia/phpldapadmin:0.9.0 hostname: phpldapadmin.docker.local networks: frontend: aliases: - phpldapadmin.docker.local backend: environment: PHPLDAPADMIN_LDAP_HOSTS: ldap PHPLDAPADMIN_HTTPS: 'false' volumes: - varwwwphpldapadmin:/var/www/phpldapadmin labels: - "traefik.enable=true" - "traefik.docker.network=frontend" # http entrypoint - "traefik.http.middlewares.phpldapadmin-http2https.redirectscheme.permanent=true" - "traefik.http.middlewares.phpldapadmin-http2https.redirectscheme.scheme=https" - "traefik.http.routers.phpldapadmin-http.entryPoints=http" - "traefik.http.routers.phpldapadmin-http.rule=Host(`phpldapadmin.docker.local`)" - "traefik.http.routers.phpldapadmin-http.middlewares=phpldapadmin-http2https" # https entrypoint - "traefik.http.routers.phpldapadmin-https.entryPoints=https" - "traefik.http.routers.phpldapadmin-https.rule=Host(`phpldapadmin.docker.local`)" - "traefik.http.routers.phpldapadmin-https.service=phpldapadmin-https" - "traefik.http.routers.phpldapadmin-https.tls=true" - "traefik.http.services.phpldapadmin-https.loadbalancer.passhostheader=true" - "traefik.http.services.phpldapadmin-https.loadbalancer.server.port=80" - "traefik.http.services.phpldapadmin-https.loadbalancer.server.scheme=http"
Both traefik and phpldapadmin containers are in the same network as showed below:
❯ docker network inspect ldap_frontend [ { "Name": "ldap_frontend", "Id": "d84a4c4dfaf229bd68b33ec1eee21d43d4f8631cd3aaf6788d37c799e9422d48", "Created": "2020-03-28T12:32:16.752088842Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.20.0.0/16", "Gateway": "172.20.0.1" } ] }, "Internal": false, "Attachable": true, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "48ad2ff71b46d7c1c8a742366e683eb24d55ad36792c6268fec439296143b267": { "Name": "ldap_phpldapadmin_1", "EndpointID": "c288b66d01eccf90f79fef07aaba4874f0f7a3817521a1c86d244ca88a26cb43", "MacAddress": "02:42:ac:14:00:02", "IPv4Address": "172.20.0.2/16", "IPv6Address": "" }, "df8352145f9307d09579d5745411abc51d786f627aa04ea21ba1d70d4c87fac3": { "Name": "ldap_traefik_1", "EndpointID": "458c136de2b4ea35ce0d5fdaa44dbeb26df71efaf82d0eb7ba1ac9e0d4bbc38c", "MacAddress": "02:42:ac:14:00:03", "IPv4Address": "172.20.0.3/16", "IPv6Address": "" } }, "Options": {}, "Labels": { "com.docker.compose.network": "frontend", "com.docker.compose.project": "ldap", "com.docker.compose.version": "1.25.4" } } ] ❯ docker network inspect ldap_backend [ { "Name": "ldap_backend", "Id": "210404e96a48fae8bc0fc689f834133c619f56d91e0d07511ae59599adc6d199", "Created": "2020-03-28T12:32:16.795605381Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.21.0.0/16", "Gateway": "172.21.0.1" } ] }, "Internal": false, "Attachable": true, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "48ad2ff71b46d7c1c8a742366e683eb24d55ad36792c6268fec439296143b267": { "Name": "ldap_phpldapadmin_1", "EndpointID": "98f3d4a93c01c9ad9db5e1d4eacdf2bdff003a51c314d1bbd74178a0544b67c4", "MacAddress": "02:42:ac:15:00:03", "IPv4Address": "172.21.0.3/16", "IPv6Address": "" }, "dea2ed5f1185353775d37c762e03812cbbf9ed91162a4be8d3f7b1b65faa7eec": { "Name": "ldap_ldap_1", "EndpointID": "195048371e1dbd131cbf2d0c8a6f432feb90228bd981ded04592a862a570cb9e", "MacAddress": "02:42:ac:15:00:02", "IPv4Address": "172.21.0.2/16", "IPv6Address": "" } }, "Options": {}, "Labels": { "com.docker.compose.network": "backend", "com.docker.compose.project": "ldap", "com.docker.compose.version": "1.25.4" } } ]
When I check traefik logs, I found that traefik use backend network to proxy on phpldapadmin:
traefik_1 | 172.20.0.1 - - [28/Mar/2020:12:32:56 +0000] "GET / HTTP/2.0" 504 15 "-" "-" 1 "phpldapadmin-https@docker" "http://172.21.0.3:80" 30006ms
I have configured traefik to use only the frontend network, so how is it possible that traefik tries to use the backend network?
This problem has been encountered with both version 2.1 and 2.2 of traefik.
Hello,
It's not the good place for this issue.
Hi,
I setup two network: frontend and backend into docker-compose.yml
Both traefik and phpldapadmin containers are in the same network as showed below:
When I check traefik logs, I found that traefik use backend network to proxy on phpldapadmin:
I have configured traefik to use only the frontend network, so how is it possible that traefik tries to use the backend network?
This problem has been encountered with both version 2.1 and 2.2 of traefik.