dockerdocker-composekong

Why does kong service keep exiting?


When I run docker compose up, all services are starting, but kong exits.
When I run docker compose logs kong, I get Error: database has an invalid value: 'false' (postgres, cassandra, off).

This is my docker container:

kong:
    image: kong:latest
    environment:
      KONG_DATABASE: off
      KONG_DECLARATIVE_CONFIG: /etc/kong/kong.yml
      KONG_PROXY_ACCESS_LOG: /dev/stdout
      KONG_ADMIN_ACCESS_LOG: /dev/stdout
      KONG_PROXY_ERROR_LOG: /dev/stderr
      KONG_ADMIN_ERROR_LOG: /dev/stderr
      KONG_ADMIN_LISTEN: 0.0.0.0:8001
    volumes:
      - ./kong.yml:/etc/kong/kong.yml
    ports:
      - 8000:8000
      - 8443:8443
      - 8001:8001
      - 8444:8444
    networks:
      - movie-network

This is my kong.yml file:

_format_version: "1.1"
services:
  - name: movie-service
    url: http://movie_service:8003
    routes:
      - name: movie-route
        paths:
          - /movies

  - name: reviews-service
    url: http://reviews_service:8004
    routes:
      - name: reviews-route
        paths:
          - /reviews

  - name: recommendation-service
    url: http://recommendation_service:8005
    routes:
      - name: recommendation-route
        paths:
          - /recommendations

How can I fix this?


Solution

  • I fixed this issue by modifying the Kong service environment variables as follows:

    environment:
      - KONG_DATABASE=off
      - KONG_DECLARATIVE_CONFIG=/etc/kong/kong.yml
      - KONG_PROXY_ACCESS_LOG=/dev/stdout
      - KONG_ADMIN_ACCESS_LOG=/dev/stdout
      - KONG_PROXY_ERROR_LOG=/dev/stderr
      - KONG_ADMIN_ERROR_LOG=/dev/stderr
      - KONG_ADMIN_LISTEN=0.0.0.0:8001