Search code examples
dockerredisdocker-composekanban

Docker-Compose error with Kanban and Redis


while i installed Kanban and Redis on my Server, which OS is CentOS 7, i get some issue, which i can't make out. This is what i want to do: i want to have three docker containers -> gitlab -> redis -> kanban. When i'm starting this the container without docker-compose.yml it works perfectly. But i want to start this containers from the yml-file. So i wrote this file:

version: '2'

services:
  gitlab:
    restart: always
    image: 'gitlab/gitlab-ce:latest'
    ports:
    - "80:80"
    - "443:443"
    - "10022:22"
    volumes:
    - /srv/gitlab/config:/etc/gitlab
    - /srv/gitlab/logs:/var/log/gitlab
    - /srv/gitlab/data:/var/opt/gitlab

  kanban_redis:
    restart: always
    image: 'leanlabs/redis:lastest'
    ports:
    - "6379:6379"

  kanban:
    restart: always
    image: "leanlabs/kanban:latest"
    ports:
    - "8080:80"
    links:
    - kanban_redis
    environment:
    - KANBAN_SERVER_HOSTNAME="http://localhost"
    - KANBAN_SERVER_LISTEN="0.0.0.0:80"
    - KANBAN_GITLAB_URL="http://mygitlab.com"
    - KANBAN_GITLAB_CLIENT="Application ID"
    - KANBAN_GITLAB_SECRET="Secret"
    - KANBAN_REDIS_ADDR="kanban_redis:6379"

But when i'm starting this file with docker-compose up, so i'm getting this error:

kanban_1 | 2016/06/03 06:12:47 Error connection to redis dial tcp: unknown port tcp/6379" kanban_1 exited with code 1

Gitlab and Redis starts normally. Do you have an idea to resolve this?

Thanks!


Solution

  • I suspect you are encountering a race condition where your kanban_redis container is up but has not yet started redis.

    What you will have to do is create a custom run command for your kanban container. In this command you should loop whilst the tcp:\\kanban_redis:6379 is closed. Once open run /kanban server. (see this post on checking tcp ports)

    Unfortunately there is currently no other way around this.