Struggling to get backend to start with docker
Describe the bug
I cannot get the backend to start regardless of the environmental variables I pass. There is also no clear guidance on how to run this in production behind a reverse proxy.
The getting started docs seems to indicate that I can use HTTPS_ENABLED=true if doorman is behind a reverse proxy but .env.example says it can only be true if HTTPS_ONLY is also true and I am not terminating TLS with doorman. It's also not clear if I can use either one of these if ENV=development.
Regardless of what combination of variables I use, though, I can get the frontend to start and a little bit of logging from backend but there is never logging to indicate the backend has actually started. execing into the container and trying to curl localhost:3001 shows nothing is running on PORT.
Excerpt from my docker-compose stack:
services:
backend:
image: myDoormanImagePlaceholder
networks:
- default
- internal_overlay
environment:
ENV: production
HTTPS_ONLY: false
HTTPS_ENABLED: true
JWT_SECRET_KEY: ${DOORMAN_JWT}
TOKEN_ENCRYPTION_KEY: ${DOORMAN_TOKEN_KEY}
MEM_ENCRYPTION_KEY: ${DOORMAN_TOKEN_KEY}
ALLOWED_ORIGINS: https://gateway.mydomain.com
CORS_STRICT: true
COOKIE_DOMAIN: mydomain.com
ALLOW_CREDENTIALS: Ttue
LOG_FORMAT: json
MEM_OR_EXTERNAL: REDIS
REDIS_HOST: redis
REDIS_PORT: 6379
MONGO_DB_HOSTS: mongo:27017
MONGO_REPLICA_SET_NAME: rs0
DOORMAN_ADMIN_EMAIL: ${DOORMAN_ADMIN_EMAIL}
DOORMAN_ADMIN_PASSWORD: ${DOORMAN_ADMIN_PASSWORD}
MONGO_DB_PASSWORD: ${DOORMAN_MONGO_PW}
MONGO_DB_USER: doorman
NEXT_PUBLIC_SERVER_URL: https://api.mydomain.com
NEXT_PUBLIC_API_URL: https://api.mydomain.com
NEXT_PUBLIC_APP_URL: https://gateway.mydomain.com
PORT: 3001
DEV_RELOAD: false
THREADS: 4
PID_FILE: doorman.pid
labels:
traefik.enable: true
traefik.http.routers.doorman.rule: Host(`api.mydomain.com`)
traefik.http.services.doorman.loadbalancer.server.port: 3001
traefik.http.routers.doorman-ui.rule: Host(`gateway.mydomain.com`)
traefik.http.services.doorman-ui.loadbalancer.server.port: 3000
traefik.http.routers.doorman-ui.service: doorman-ui
traefik.docker.network: internal_overlay
volumes:
- /my/data/path/doorman/certs:/certs:ro
# ...
I removed mongo/redis and substituted my specific urls/images for placeholders.
This is on version 1.0.0 built with Dockerfile
Logs from container:
backend-1 | [entrypoint] Starting Doorman backend...
backend-1 | [entrypoint] Starting web client...
backend-1 | [entrypoint] Services launched. Backend PID=9 Web PID=11
backend-1 |
backend-1 | > [email protected] start
backend-1 | > next start -H 0.0.0.0 -p 3000
backend-1 |
backend-1 | ▲ Next.js 15.5.2
backend-1 | - Local: http://localhost:3000
backend-1 | - Network: http://0.0.0.0:3000
backend-1 |
backend-1 | ✓ Starting...
backend-1 | ✓ Ready in 693ms
backend-1 | {"time": "2025-12-10T18:07:15", "name": "doorman.gateway", "level": "INFO", "message": "Response compression enabled: level=1, minimum_size=500 bytes"}
backend-1 | {"time": "2025-12-10T18:07:15", "name": "doorman.gateway", "level": "INFO", "message": "Generated dir: /app/backend-services/generated (no migration needed)"}
backend-1 | {"time": "2025-12-10T18:07:15", "name": "doorman.gateway", "level": "INFO", "message": "Starting doorman with PID 38."}
Additional context
I had to track down the NEXT_PUBLIC_* envs in the dockerfile and provide them as build args in order to get the frontend to actually work with my reverse proxy. Using them strictly as ENVs is not enough. It's probably a good idea to document these as well.
Well, it does seem to be running a subprocess with run but there is no log output to the container or port exposed, still. Nothing created in /app/backend-services/logs inside the container.
The spawned threads are killed within 10 seconds of starting, endlessly repeating.
@FoxxMD hi there. Sorry about the difficulty with setup. I’ve actually made it my priority to make the setup easier. Friday I’m making a release from develop.
Develop isn’t stable yet but is much easier to configure. A few more features too. Let’s link up next week once you have some time to take a look at the next release!
Thanks, Mitchell
@FoxxMD, also something to note. We will be utilizing reverse proxy as the point of https and not forcing it on the system. There are still some http/s settings to configure. Logging is also working better with the latest update.
I was very focused on development instances working for v1.0.0, the next version will have a more production ready feel.
Thanks for the response.
I've already spun up apache apisix which is doing the job for me but I'll still be interested to see how the next release of doorman compares.
Release v1.1.0 with a streamlined setup and improvements across the gateway. Marking this issue as closed. Thanks for the feedback!
Please re-open this.
Using either production or development for ENV still results in the UI trying to using localhost as the domain, when I have doorman behind a reverse proxy.
Bottom line: If you can't get your service to build in a way that anyone could use it from a pre-built image on a registry, you probably shouldn't be releasing it. Frontends that are domain agnostic are a solved problem, please don't rely on args at build time to make the front end work correctly.
@FoxxMD, I see the issue and the gap in testing called out here.
NEXT_PUBLIC_SERVER_URL and NEXT_PUBLIC_API_URL are being hardcoded in the Dockerfile resulting in the localhost issue. Will fix this, update the testing required for the release, and push a patch today.
Appreciate the feedback as always.
Considering my issues was more related to the experience of setting up doorman, rather than a specific bug that you can verify is fixed, it seems presumptuous to have closed this without having first verified with me if the changes you've made have actually solved my problem.
Hi @FoxxMD , was reading through this last night and must have clicked to close it. Thanks for reaching out on this.
I relaunched v1.0.0 with a lot simpler of a setup. Very few fields need configured and you can also launch a demo of the application to view the UI.
I am unable to login with my default admin login/password due to "Invalid CSRF token".
Doorman is running behind Traefik with these (domain substituted) endpoints:
UI: https://gateway.mydomain.com API: https://api.mydomain.com
I built the latest main branch Dockerfile with build arg NEXT_PUBLIC_GATEWAY_URL=https://api.mydomain.com.
.env file -- the bracketed values are intentional, I use Komodo which substitutes [[value]] for real values at runtime.
ENV=production
DOORMAN_ADMIN_EMAIL=[[DOORMAN_ADMIN_EMAIL]]
DOORMAN_ADMIN_PASSWORD=[[DOORMAN_ADMIN_PASSWORD]]
DOORMAN_MONGO_PW=[[DOORMAN_MONGO_PW]]
MEM_OR_EXTERNAL=MEM
REDIS_HOST=redis
REDIS_PORT=6379
MONGO_DB_HOSTS="mongo:27017"
MONGO_DB_PASSWORD=[[DOORMAN_MONGO_PW]]
MONGO_DB_USER=doorman_admin
JWT_SECRET_KEY=[[DOORMAN_JWT]]
TOKEN_ENCRYPTION_KEY=[[DOORMAN_TOKEN_KEY]]
MEM_ENCRYPTION_KEY=[[DOORMAN_TOKEN_KEY]]
HTTPS_ONLY=true
COOKIE_DOMAIN=mydomain.com
COOKIE_SAMESITE=Lax
HTTP_CONNECT_TIMEOUT=5.0
HTTP_READ_TIMEOUT=30.0
HTTP_WRITE_TIMEOUT=30.0
HTTP_TIMEOUT=30.0
ENABLE_HTTPX_CLIENT_CACHE=true
HTTP_MAX_CONNECTIONS=100
HTTP_MAX_KEEPALIVE=50
HTTP_KEEPALIVE_EXPIRY=30.0
LOG_FORMAT=plain
PORT=3001
WEB_PORT=3000
THREADS=1
DEV_RELOAD=false
PID_FILE=doorman.pid
DOORMAN_ENABLE_GQL_CLIENT=True
Trying to login sends a request with a cookie
and the response returns an access token
and it looks like things are going OK in the logs, but then future calls error with csrf reject
doorman-1 | 2026-01-26 21:22:47,263 - doorman.gateway - INFO - 96fbdd3e-f596-443c-b251-f511939d5fb9 | From: 10.0.2.107:33072
doorman-1 | 2026-01-26 21:22:47,264 - doorman.gateway - INFO - 96fbdd3e-f596-443c-b251-f511939d5fb9 | Endpoint: POST /platform/authorization
doorman-1 | 2026-01-26 21:22:47,571 - doorman.gateway - INFO - Creating token for user admin with accesses: {'ui_access': True, 'manage_users': True, 'manage_apis': True, 'manage_endpoints': True, 'manage_groups': True, 'manage_roles': True, 'manage_routings': True, 'manage_gateway': True, 'manage_subscriptions': True, 'manage_security': True, 'export_logs': True, 'view_logs': True}
doorman-1 | 2026-01-26 21:22:47,574 - doorman.gateway - INFO - Login successful for user: admin
doorman-1 | 2026-01-26 21:22:47,575 - doorman.gateway - INFO - 96fbdd3e-f596-443c-b251-f511939d5fb9 | Total time: 312.224365234375ms
doorman-1 | INFO: 10.0.2.107:33072 - "POST /platform/authorization HTTP/1.1" 200 OK
doorman-1 | 2026-01-26 21:22:47,604 - doorman.gateway - INFO - 4705b778-40ac-4b30-a4e0-c674fe7d0ce3 | Entry: client_ip=10.0.2.107 effective_ip=10.0.2.107 method=OPTIONS path=/platform/user/me
doorman-1 | INFO: 10.0.2.107:33072 - "OPTIONS /platform/user/me HTTP/1.1" 204 No Content
doorman-1 | 2026-01-26 21:22:47,644 - doorman.gateway - INFO - d9beff01-375f-4fd6-b159-7ccbc347e535 | Entry: client_ip=10.0.2.107 effective_ip=10.0.2.107 method=GET path=/platform/user/me
doorman-1 | 2026-01-26 21:22:47,647 - doorman.gateway - INFO - CSRF reject: header/cookie missing or mismatch
doorman-1 | 2026-01-26 21:22:47,647 - doorman.gateway - INFO - 069a5f78-887a-4c65-85a3-c2b4de6777c7 | Total time: 0.50244140625ms
doorman-1 | INFO: 10.0.2.107:33072 - "GET /platform/user/me HTTP/1.1" 401 Unauthorized
doorman-1 | 2026-01-26 21:22:47,663 - doorman.gateway - INFO - da721d26-74b7-4949-bbaa-165850868220 | Entry: client_ip=10.0.2.107 effective_ip=10.0.2.107 method=OPTIONS path=/platform/authorization/invalidate
I have confirmed, as far I can verify, that X-Forwarded-Proto is being sent. I am running a container from image https-echo that returns all request headers/content as a response and this container is running on the same traefik instance with the same entrypoint/settings/etc. It shows X-Forwarded-Proto and X-Forwarded-For and my real ip.
What else can I do to verify my settings are correct? The only clue I could see is that my actual IP is 192.168.... but client_ip from doorman logs is showing 10.0.2.107 which is traefik's IP.
Hi @FoxxMD , issue seems to be in the auth token being created on the Doorman side. The test setup right now is local docker then to our dev server where we don't use a split setup. I will setup an additional test server with this setup to test further and resolve tonight.
Thanks. To be clear I am running this all on one container, just with UI and API on different routes through the reverse proxy. I figured this was okay since it was detailed in the env with the gateway URL and cookie strictness
Hi @FoxxMD , created a v1.0.1 release with a fix. Was a cookie domain being set to none instead of the actual value needed.
I deployed to AWS with this setup api.doorman.dev and app.doorman.dev. Onboarded a fresh public REST api and all is working as expected.
Let me know if you run into any other issues. Thank you!
Thank you for the all the effort you've put in. 1.0.1 works and I can finally access the dashboard to try out doorman! 🎉