Issue with Docker Compose and Traefik #123

Closed
opened 2026-02-04 17:18:13 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @h2seo on GitHub (Aug 10, 2021).

I wanted to try Planka on docker compose with Traefik but it doesn't seem to work. only error "Bad Gateway"

docker-compose.yml

  planka:
    image: meltyshev/planka:latest
    command: >
      bash -c
        "for i in `seq 1 30`; do
          ./start.sh &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 seconds...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
      - user-avatars:/app/public/user-avatars
      - project-background-images:/app/public/project-background-images
      - attachments:/app/public/attachments
    ports:
      - 3000:1337
    networks:
    - web
    labels:
      - traefik.backend=planka
      - traefik.frontend.rule=Host:planka.x069.duckdns.org
      - traefik.docker.network=web
      - traefik.port=3000
      - traefik.enable=true

    environment:
      - BASE_URL=http://localhost:3000
      - DATABASE_URL=postgresql://postgres@postgres/planka
      - SECRET_KEY=notsecretkey
    depends_on:
      - postgres

  postgres:
    image: postgres:alpine
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust

volumes:
  user-avatars:
  project-background-images:
  attachments:
  db-data:

Originally created by @h2seo on GitHub (Aug 10, 2021). I wanted to try Planka on docker compose with Traefik but it doesn't seem to work. only error "Bad Gateway" docker-compose.yml ``` planka: image: meltyshev/planka:latest command: > bash -c "for i in `seq 1 30`; do ./start.sh && s=$$? && break || s=$$?; echo \"Tried $$i times. Waiting 5 seconds...\"; sleep 5; done; (exit $$s)" restart: unless-stopped volumes: - user-avatars:/app/public/user-avatars - project-background-images:/app/public/project-background-images - attachments:/app/public/attachments ports: - 3000:1337 networks: - web labels: - traefik.backend=planka - traefik.frontend.rule=Host:planka.x069.duckdns.org - traefik.docker.network=web - traefik.port=3000 - traefik.enable=true environment: - BASE_URL=http://localhost:3000 - DATABASE_URL=postgresql://postgres@postgres/planka - SECRET_KEY=notsecretkey depends_on: - postgres postgres: image: postgres:alpine restart: unless-stopped volumes: - db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust volumes: user-avatars: project-background-images: attachments: db-data: ```
Author
Owner

@johnchristopher commented on GitHub (Aug 16, 2021):

It's a Traefik misconfiguration, the port you tell Traefik to send traffic to is wrong.

Try this:

  labels:
      - traefik.backend=planka
      - traefik.frontend.rule=Host:planka.x069.duckdns.org
      - traefik.docker.network=web
      - traefik.port=1337
      - traefik.enable=true

And you can remove this part unless you want to be able to access planka directly from opened port 3000 on your server:

    ports:
      - 3000:1337

If you still get bad gateway it means Traefik can't find a port on the container, so expose it (to Traefik and end points on your docker web network) but normally planka exposes this port by default:

expose:
  - "3000"

Make sure the traefik container can talk with the docker web network:

$ docker connect web traefik

edit: here's a working docker-compose I wrote from the one you supplied. I am using Traefik2 with self-signed certificates on localhost but planka service don't need to change:

---
networks:
  default:
    external:
      name: planka

services:
  planka:
    image: meltyshev/planka:latest
    command: >
      bash -c
        "for i in `seq 1 30`; do
          ./start.sh &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 seconds...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
      - user-avatars:/app/public/user-avatars
      - project-background-images:/app/public/project-background-images
      - attachments:/app/public/attachments
    labels:
      - traefik.enable=true
      - traefik.http.routers.planka.entrypoints=https
      - traefik.http.routers.planka.rule=Host(`planka.localhost`)
      - traefik.http.routers.planka.tls=true
      - traefik.http.services.planka.loadbalancer.server.port=1337
    environment:
      - BASE_URL=https://planka.localhost # am using https but http is fine if you configured traefik to use http
      - DATABASE_URL=postgresql://postgres@postgres/planka
      - SECRET_KEY=notsecretkey
    depends_on:
      - postgres

  postgres:
    image: postgres:alpine
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust

version: 3.4

volumes:
  user-avatars:
  project-background-images:
  attachments:
  db-data:

Then:

$ docker network create planka ; docker network connect planka traefik ; docker-compose up -d ;
@johnchristopher commented on GitHub (Aug 16, 2021): It's a Traefik misconfiguration, the port you tell Traefik to send traffic to is wrong. Try this: ```yaml labels: - traefik.backend=planka - traefik.frontend.rule=Host:planka.x069.duckdns.org - traefik.docker.network=web - traefik.port=1337 - traefik.enable=true ``` And you can remove this part unless you want to be able to access planka directly from opened port 3000 on your server: ``` ports: - 3000:1337 ``` If you still get `bad gateway` it means Traefik can't find a port on the container, so expose it (to Traefik and end points on your docker web network) but normally planka exposes this port by default: ```yaml expose: - "3000" ``` Make sure the traefik container can talk with the docker web network: ```bash $ docker connect web traefik ``` edit: here's a working docker-compose I wrote from the one you supplied. I am using Traefik2 with self-signed certificates on localhost but planka service don't need to change: ```yaml --- networks: default: external: name: planka services: planka: image: meltyshev/planka:latest command: > bash -c "for i in `seq 1 30`; do ./start.sh && s=$$? && break || s=$$?; echo \"Tried $$i times. Waiting 5 seconds...\"; sleep 5; done; (exit $$s)" restart: unless-stopped volumes: - user-avatars:/app/public/user-avatars - project-background-images:/app/public/project-background-images - attachments:/app/public/attachments labels: - traefik.enable=true - traefik.http.routers.planka.entrypoints=https - traefik.http.routers.planka.rule=Host(`planka.localhost`) - traefik.http.routers.planka.tls=true - traefik.http.services.planka.loadbalancer.server.port=1337 environment: - BASE_URL=https://planka.localhost # am using https but http is fine if you configured traefik to use http - DATABASE_URL=postgresql://postgres@postgres/planka - SECRET_KEY=notsecretkey depends_on: - postgres postgres: image: postgres:alpine restart: unless-stopped volumes: - db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust version: 3.4 volumes: user-avatars: project-background-images: attachments: db-data: ``` Then: ```shell $ docker network create planka ; docker network connect planka traefik ; docker-compose up -d ; ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#123