title: Docker error when I try to run Kong: nginx configuration is invalid
body: <p>I want to use Docker to run Kong with OIDC plugin in order to connect it with an external Keycloak server. The Kong container exits with code 1 because of a bad configuration of its nginx server. I have this <strong>docker-compose.yml</strong>:</p>
  <pre><code>version: '3.8'
  networks:
    kong-net:
  services:
    kong:
      build: ./kong
      image: amilcar-backend/kong
      networks:
        - kong-net
      depends_on:
        - kong-db
      environment:
        KONG_DATABASE: postgres
        KONG_PG_HOST: kong-db
        KONG_PG_DATABASE: kong
        KONG_PG_PASSWORD: kong
        KONG_PG_USER: kong
        KONG_ADMIN_ACCESS_LOG: /dev/stdout
        KONG_ADMIN_ERROR_LOG: /dev/stderr
        KONG_PROXY_ACCESS_LOG: /dev/stdout
        KONG_PROXY_ERROR_LOG: /dev/stderr
        KONG_ADMIN_LISTEN: 0.0.0.0:8001
        KONG_CASSANDRA_CONTACT_POINTS: postgres
        KONG_NGINX_PROXY_SET: '$session_secret amUgc8OpY3VyaKJIHGENldHRlIHJvdXRl'
        KONG_PLUGINS: oidc
      ports:
        - '8000:8000'
        - '8001:8001'
    kong-migration:
      image: amilcar-backend/kong
      command: &quot;kong migrations bootstrap&quot;
      networks:
        - kong-net
      restart: on-failure
      environment:
        KONG_PG_HOST: kong-db
        KONG_PG_DATABASE: kong
        KONG_PG_PASSWORD: kong
      depends_on:
        - kong-db
        - kong
    kong-db:
      image: 'postgres:12.6-alpine'
      container_name: 'kong-db'
      networks:
        - kong-net
      ports:
        - '5436:5432'
      environment:
        POSTGRES_USER: kong
        POSTGRES_PASSWORD: kong
        POSTGRES_DB: kong
      volumes:
        - kong-postgres:/var/lib/postgresql/data
    db:
      image: 'postgres:12.6-alpine'
      container_name: 'db'
      ports:
        - '5434:5432'
      env_file: .env
      volumes:
        - postgres:/var/lib/postgresql/data
  volumes:
    postgres:
    kong-postgres:
  </code></pre>
  <p>And I have this Dockerfile in <strong>./kong</strong>:</p>
  <pre><code>FROM kong:latest
  USER root
  RUN luarocks install kong-oidc
  USER kong
  CMD [&quot;kong&quot;, &quot;docker-start&quot;]
  </code></pre>
  <p>It's all good unless the Kong container, it throws this error:</p>
  <pre><code>kong_1 | Error: could not prepare Kong prefix at /usr/local/kong: nginx configuration is invalid (exit code 1):
  kong_1 | nginx: [emerg] invalid number of arguments in &quot;set&quot; directive in /usr/local/kong/nginx-kong.conf:80
  kong_1 | nginx: configuration file /usr/local/kong/nginx.conf test failed
  </code></pre>
  <p>I tried different solutions but this error follows me everywhere...</p>