Problem with connection PgAdmin container to Traefik

Hello everyone. I have a problem. I can't get certificate from traefik to Pgadmin container. I know that sertificates generated, but pgadmin can't see that. In traefik logs i see only this line:

"GET /add_data.php?adr_id=1&type=WFM&values=0.0;0.0; HTTP/1.1" 404 19 "-" "-" 154 "-" "-" 0ms.

My docker compose file:

version: '3.0'

services:

  traefik:
    container_name: traefik
    image: traefik:v2.3
    ports:
      - 80:80
      - 443:443
    restart: always
    labels:
      - traefik.enable=true
      - traefik.http.services.traefik-dashboard.loadbalancer.server.port=8080
      - traefik.http.routers.traefik-dashboard-http.entrypoints=http
      - traefik.http.routers.traefik-dashboard-http.rule=Host(`hostname`)
      - traefik.docker.network=traefik-public
      - traefik.http.routers.traefik-dashboard-https.entrypoints=https
      - traefik.http.routers.traefik-dashboard-https.rule=Host(`hostname`)
      - traefik.http.routers.traefik-dashboard-https.tls=true
      - traefik.http.routers.traefik-dashboard-https.tls.certresolver=le
      - traefik.http.routers.traefik-dashboard-https.service=api@internal
      - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
      - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
      - traefik.http.routers.traefik-dashboard-http.middlewares=https-redirect
      - traefik.http.middlewares.admin-auth.basicauth.users=${USERNAME}:${HASHED_PASSWORD}
      - traefik.http.routers.traefik-dashboard-https.middlewares=admin-auth
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - traefik-public-certificates:/certificates
    command:
      - "--providers.docker"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.http.address=:80"
      - "--entrypoints.https.address=:443"
      - "--certificatesresolvers.le.acme.email=email"
      - "--certificatesresolvers.le.acme.storage=/certificates/acme.json"
      - "--certificatesresolvers.le.acme.tlschallenge=true"
      - "--accesslog"
      - "--log"
      - "--api"
    networks:
      - traefik-public

  db:
    container_name: db
    image: postgres:14-alpine
    restart: always
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=database

  pgadmin:
    container_name: pgadmin
    image: dpage/pgadmin4:6.18
    restart: always
    environment:
      - PGADMIN_DEFAULT_EMAIL=email
      - PGADMIN_DEFAULT_PASSWORD=password
      - PGADMIN_LISTEN_PORT=80
    volumes:
      - pgadmin_data:/var/lib/pgadmin/data/
    ports:
      - 9000:80
    labels:
      - traefik.enable=true
      - traefik.http.services.pgadmin.loadbalancer.server.port=9000
      - traefik.http.routers.pgadmin-http.entrypoints=http
      - traefik.http.routers.pgadmin-http.rule=Host(`hostname`) 
      - traefik.docker.network=traefik-public
      - traefik.http.routers.pgadmin-https.entrypoints=https
      - traefik.http.routers.pgadmin.rule=Host(`hostname`)
      - traefik.http.middlewares.pgadmin-https.redirectscheme.scheme=https
      - traefik.http.middlewares.pgadmin-https.redirectscheme.permanent=true
      - traefik.http.routers.pgadmin-http.middlewares=pgadmin-https@docker
      - traefik.http.routers.pgadmin-https.middlewares=admin-auth
      - traefik.http.routers.pgadmin.tls=true
      - traefik.http.routers.pgadmin.tls.certresolver=le
    networks:
      - traefik-public
    links:
      - "db:pgsql-server"

volumes:
  postgres_data:
  pgadmin_data:
  traefik-public-certificates:

networks:
  traefik-public:
    external: true

I tried a lot of variants from different sites, but I have only mistakes. Thank you in advance! :slight_smile:

I recommend to enable and check Traefik debug log and Traefik Dashboard.

Your rule=Host() lines need to use a public domain name that resolves to the Traefik IP for LetsEncrypt to work.

Thanks for the answer)
The problem is that the public domain is used, I just hid it

Well, did you

?

Your pgadmin service user 3 different routers (traefik.http.routers.x), is that on purpose?

You could set the http->https redirect directly in entrypoint (docs).

Links is normally used with CLI, but not compose. Docker will place compose services on a Docker network anyway. I would make it explicit with a dedicated Docker network, see simple example:

networks:
  proxy:
    name: proxy