FrontEnd Seems to be ignoring the port settings in compose.yml

1. The problem I’m having:

I Am trying to change the default front end web port from 80 to 8080, but Somehow it always seems to revert back to 80
I am running this in a docker container under ubuntu 13

2. Error messages and/or full log output:

root@Caddy:/home/caddy/caddymanager# docker-compose up
\[+\] Running 1/2
✔ Container caddymanager-backend   Created                                                                                                                                                                 0.0s
⠙ Container caddymanager-frontend  Recreated                                                                                                                                                               0.1s
Attaching to caddymanager-backend, caddymanager-frontend
caddymanager-backend   |
caddymanager-backend   | > caddy-manager-backend@0.0.2 prestart
caddymanager-backend   | > npm run generate-build-info
caddymanager-backend   |
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.861744,“msg”:“maxprocs: Leaving GOMAXPROCS=2: CPU quota undefined”}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.8626196,“msg”:“GOMEMLIMIT is updated”,“package”:“github.com/KimMachineGun/automemlimit/memlimit",“GOMEMLIMIT”:3693146112,"previous”:9223372036854775807}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.863154,“msg”:“using config from file”,“file”:“/etc/caddy/Caddyfile”}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.8653011,“msg”:“adapted config to JSON”,“adapter”:“caddyfile”}
caddymanager-frontend  | {“level”:“warn”,“ts”:1778075782.8653262,“msg”:“Caddyfile input is not formatted; run ‘caddy fmt --overwrite’ to fix inconsistencies”,“adapter”:“caddyfile”,“file”:“/etc/caddy/Caddyfile”,“line”:2}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.8679698,“logger”:“admin”,“msg”:“admin endpoint started”,“address”:“localhost:2019”,“enforce_origin”:false,“origins”:\[“//127.0.0.1:2019”,“//localhost:2019”,“//\[::1\]:2019”\]}
caddymanager-frontend  | {“level”:“warn”,“ts”:1778075782.868526,“logger”:“http.auto_https”,“msg”:“server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server”,“server_name”:“srv0”,“http_port”:80}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.8686726,“logger”:“tls.cache.maintenance”,“msg”:“started background certificate maintenance”,“cache”:“0xc00022fd00”}
caddymanager-frontend  | {“level”:“warn”,“ts”:1778075782.869979,“logger”:“http”,“msg”:“HTTP/2 skipped because it requires TLS”,“network”:“tcp”,“addr”:“:80”}
caddymanager-frontend  | {“level”:“warn”,“ts”:1778075782.8699987,“logger”:“http”,“msg”:“HTTP/3 skipped because it requires TLS”,“network”:“tcp”,“addr”:“:80”}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.870006,“logger”:“http.log”,“msg”:“server running”,“name”:“srv0”,“protocols”:\[“h1”,“h2”,“h3”\]}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.8709238,“msg”:“autosaved config (load with --resume flag)”,“file”:“/config/caddy/autosave.json”}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.8709471,“msg”:“serving initial configuration”}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.877597,“logger”:“tls”,“msg”:“cleaning storage unit”,“storage”:“FileStorage:/data/caddy”}
caddymanager-frontend  | {“level”:“info”,“ts”:1778075782.8841991,“logger”:“tls”,“msg”:“finished cleaning storage units”}
caddymanager-backend   |
caddymanager-backend   | > caddy-manager-backend@0.0.2 generate-build-info
caddymanager-backend   | > node scripts/generateBuildInfo.js
caddymanager-backend   |
caddymanager-backend   | Using git info from build arguments
caddymanager-backend   | ✅ Build information generated successfully
caddymanager-backend   | 📦 Version: 0.0.2
caddymanager-backend   | 🔢 Build: 27
caddymanager-backend   | 🌿 Branch: main
caddymanager-backend   | 📝 Commit: 52f69b64
caddymanager-backend   |
caddymanager-backend   | > caddy-manager-backend@0.0.2 start
caddymanager-backend   | > node app.js
caddymanager-backend   |
caddymanager-backend   | Not all input has been taken into account at your final specification.
caddymanager-backend   | Here’s the report:
caddymanager-backend   |
caddymanager-backend   |
caddymanager-backend   |  Error in ./controllers/metricsController.js :
caddymanager-backend   | YAMLSemanticError: Nested mappings are not allowed in compact mappings at line 11, column 22:
caddymanager-backend   |
caddymanager-backend   |         description: Limit the number of historical entries returned (default: …
caddymanager-backend   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^…
caddymanager-backend   |
caddymanager-backend   | Connected to SQLite at /app/data/caddymanager.sqlite
caddymanager-backend   | ✅ Build info loaded successfully
caddymanager-backend   | Connected to SQLite at /app/data/caddymanager.sqlite
caddymanager-backend   | Using SQLite as the database engine.
caddymanager-backend   | {“timestamp”:“2026-05-06T13:56:23.947Z”,“service”:“pingService”,“level”:“info”,“message”:“Starting ping service”,“data”:{“intervalMs”:30000,“intervalSeconds”:30,“timeoutMs”:2000,“timeoutSeconds”:2}}\`\`

3. Caddy version:

caddymanager-backend   | Using git info from build arguments
caddymanager-backend   | ✅ Build information generated successfully
caddymanager-backend   | 📦 Version: 0.0.2
caddymanager-backend   | 🔢 Build: 27
caddymanager-backend   | 🌿 Branch: main
caddymanager-backend   | 📝 Commit: 52f69b64

4. How I installed and ran Caddy:

Created a compose.yml file, containing the info from the main site, then modified it slightly, aka changing the port assignment

a. System environment:

Linux Caddy 6.12.85+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.85-1 (2026-04-30) x86_64 GNU/Linux

b. Command:

docker-compose up

c. Service/unit/compose file:

services:
  # MongoDB database for persistent storage (optional - SQLite is used by default)
  mongodb:
    image: mongo:8.0
    container_name: caddymanager-mongodb
    restart: unless-stopped
    environment:
      - MONGO_INITDB_ROOT_USERNAME=***
      - MONGO_INITDB_ROOT_PASSWORD=***  # Change for production!
    ports:
      - "27017:27017"  # Expose for local dev, remove for production
    volumes:
      - mongodb_data:/data/db
    networks:
      - caddymanager
    profiles:
      - mongodb  # Use 'docker-compose --profile mongodb up' to include MongoDB

  # Backend API server
  backend:
    image: caddymanager/caddymanager-backend:latest
    container_name: caddymanager-backend
    restart: unless-stopped
    environment:
      - PORT=3000
      # Database Engine Configuration (defaults to SQLite)
      - DB_ENGINE=sqlite  # Options: 'sqlite' or 'mongodb'
      # SQLite Configuration (used when DB_ENGINE=sqlite)
      - SQLITE_DB_PATH=/app/data/caddymanager.sqlite
      # MongoDB Configuration (used when DB_ENGINE=mongodb)
      - MONGODB_URI=mongodb://mongoadmin:someSecretPassword@mongodb:27017/caddymanager?authSource=admin
      - CORS_ORIGIN=http://localhost:80   - LOG_LEVEL=debug
      - CADDY_SANDBOX_URL=http://localhost:2019
      - PING_INTERVAL=30000
      - PING_TIMEOUT=2000
      - AUDIT_LOG_MAX_SIZE_MB=100
      - AUDIT_LOG_RETENTION_DAYS=90
      - METRICS_HISTORY_MAX=1000  # Optional: max number of in-memory metric history snapshots to keep
      - JWT_SECRET=123456  # Change for production!
      - JWT_EXPIRATION=24h
    # Backend is now only accessible through frontend proxy
    volumes:
      - sqlite_data:/app/data  # SQLite database storage
    networks:
      - caddymanager

  # Frontend web UI
  frontend:
    image: caddymanager/caddymanager-frontend:latest
    container_name: caddymanager-frontend
    restart: unless-stopped
    depends_on:
      - backend
    environment:
      - BACKEND_HOST=backend:3000
      - APP_NAME=Caddy Manager
      - DARK_MODE=true
    ports:
      - "8080:8080"  # Expose web UI
    networks:
      - caddymanager

networks:
  caddymanager:
    driver: bridge

volumes:
  mongodb_data:  # Only used when MongoDB profile is active
  sqlite_data:   # SQLite database storage

# Notes:
# - SQLite is the default database engine - no additional setup required!
# - To use MongoDB instead, set DB_ENGINE=mongodb and start with: docker-compose --profile mongodb up
# - For production, use strong passwords and consider secrets management.
# - The backend uses SQLite by default, storing data in a persistent volume.
# - The frontend proxies all /api/* requests to the backend service.
# - Backend is not directly exposed - all API access goes through the frontend proxy.

d. My complete Caddy config:

Client: Docker Engine - Community
Version: 29.4.2
API version: 1.54
Go version: go1.26.2
Git commit: 055a478
Built: Fri May 1 10:26:20 2026
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 29.4.2
API version: 1.54 (minimum version 1.40)
Go version: go1.26.2
Git commit: d329809
Built: Fri May 1 10:26:20 2026
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.2.3
GitCommit: 77c84241c7cbdd9b4eca2591793e3d4f4317c590
runc:
Version: 1.3.5
GitCommit: v1.3.5-0-g488fc13e
docker-init:
Version: 0.19.0
GitCommit: de40ad0

yeah, the ports: bit is probably the mismatch here.

8080:8080 only works if the thing inside the container is actually listening on 8080. your log says caddy inside the frontend container is still starting on :80:

server is listening only on the HTTP port ... "http_port":80
server running ...

so I’d try:

ports:
  - "8080:80"

that means “host port 8080 → container port 80”.

if you really want 8080:8080, then the Caddyfile inside that frontend image needs to listen on :8080. docker wont change that part for you.

also this line looks accidentally merged:

- CORS_ORIGIN=http://localhost:80   - LOG_LEVEL=debug

those should be two separate env entries, and CORS_ORIGIN probably wants http://localhost:8080 if that’s where you open the ui.

Applying both suggested changes did the trick.
The gui is now accessible via port 8080.

The real issue i have ( i need port 80 to remain free, for a different service), will be solved by changing the caddy config within the docker container.