Docker Kong admin API is unreachable Docker Kong admin API is unreachable docker docker

Docker Kong admin API is unreachable


I have encountered the same issue. The reason is the kong admin configuration set to loopback address by default. But I didn't modify the configuration file. Since Kong Docker Image providing an environment variable to expose the admin port.

KONG_ADMIN_LISTEN="0.0.0.0:8001, 0.0.0.0:8444 ssl"

This bind the admin port to the host machine port


The problem was in the binding of the admin server to localhost in /usr/local/kong/nginx-kong.conf

server {    server_name kong_admin;    listen 127.0.0.1:8001;    listen 127.0.0.1:8444 ssl;...

I've added the following code into my custom entrypoint which removes this binding just before starting nginx:

echo "Remove the admin API localhost binding..."sed -i "s|^\s*listen 127.0.0.1:8001;|listen 0.0.0.0:8001;|g" /usr/local/kong/nginx-kong.conf && \sed -i "s|^\s*listen 127.0.0.1:8444 ssl;|listen 0.0.0.0:8444 ssl;|g" /usr/local/kong/nginx-kong.confecho "Starting nginx $PREFIX..."exec /usr/local/openresty/nginx/sbin/nginx \  -p $PREFIX \  -c nginx.conf

Of course the admin ports must be closed in production some other way.