While the test instruction on official image page [1] works in case of Cassandra being datastore, the PostgreSQL one fails to run as below. See attached kong-error.log [2] for details. In the meantime, the instruction on getkong.org page [2] works well with PostgreSQL.
$ docker run --rm --name kong \
> --link kong-database:kong-database \
> -e "KONG_DATABASE=postgres" \
> -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
> -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
> -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
> -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
> -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
> -e "KONG_ADMIN_LISTEN=0.0.0.0:8001" \
> -e "KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444" \
> -p 8000:8000 \
> -p 8443:8443 \
> -p 8001:8001 \
> -p 8444:8444 \
> kong
prefix directory /usr/local/kong not found, trying to create it
2018/06/08 03:42:25 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:169: [postgres error] could not retrieve server_version: connection refused
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/init.lua:169: in function 'init'
init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:169: [postgres error] could not retrieve server_version: connection refused
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/init.lua:169: in function 'init'
init_by_lua:3: in main chunk
[1] https://hub.docker.com/_/kong/
[2] [kong-error.log](https://github.com/Kong/kong/files/2086707/kong-error.log)
[3] https://getkong.org/install/docker/?_ga=2.105349696.2124373291.1528358945-1497560862.1528358945
Is it possible that your postgres container was not up or otherwise available? Note for example that the example docker-compose environment waits on the database to be healthy and responding before attempting to run migrations: https://github.com/Kong/docker-kong/blob/master/compose/docker-compose.yml#L57-L61
Also note that the docs at https://getkong.org/install/docker/ reference the use of Docker networks instead of container links (which are deprecated), so make sure you're using the most up-to-date reference material :)
@p0pr0ck5 Thanks for the comment. My postgres container should be fine, as it works with getkong test steps [1] while doesn't with DockerHub instructions [2]. And yes, I noticed the docker networks vs. container links difference between these two sets of test instructions. I was filing this issue here just to let people know that DockerHub test instructions is not working and should probably be updated to align with getkong one.
[1] https://getkong.org/install/docker/
[2] https://hub.docker.com/_/kong/
Ah, great 馃憖. I didn't realize that was the context here :)
@gszr or @shashiranjan84?
It seems it is missing -e "KONG_PG_HOST=kong-database"?
@thibaultcha Yes, you are right. After adding -e "KONG_PG_HOST=kong-database", the test works.
Thanks.
Most helpful comment
It seems it is missing
-e "KONG_PG_HOST=kong-database"?