How to integration lua custom plugin with kong manage

I use docker to run kong manage by tutorial: Install Kong Gateway on Docker | Kong Docs

Currently. i want to add simple custom plugin GitHub - Kong/kong-plugin: Simple template to get started with custom Kong plugins to kong-manage with above docker, but i don’t know how to integration. I was read many document but i still don’t understand and document is out of date

Can u help me step by step how to integration lua custom plugin with kong manage
Thank you

You need to create a custom Kong image including your custom plugin and enable it when running as container using environment params. I have solved this sometime earlier in this post. (Use one of the latest image from kong to build your custom image)

hello @JohnWilliams

this is my Dockerfile

FROM kong/kong-gateway:3.1.1.2-alpine

USER root

RUN apk update

RUN apk add lua5.1 lua5.1-dev luarocks5.1

RUN apk add gcc expat expat-dev expat-static musl-dev

RUN luarocks install xml2lua 1.5-2

USER kong

WORKDIR /usr/local/share/lua/5.1/kong/plugins

COPY ./kong/plugins/ /usr/local/share/lua/5.1/kong/plugins

after created Dockerfile, i ran docker build command
docker build -t kong-custom-plugin --no-cache .

Finally, i run docker run command with param

-e “KONG_PLUGINS=bundled,myplugin” \

docker run -d --name kong-gateway-custom \
 --network=kong-net \
 -e “KONG_PLUGINS=bundled,myplugin” \
 -e "KONG_DATABASE=postgres" \
 -e "KONG_PG_HOST=kong-database" \
 -e "KONG_PG_USER=kong" \
 -e "KONG_PG_PASSWORD=kongpass" \
 -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_GUI_URL=http://localhost:8002" \
 -e KONG_LICENSE_DATA \
 -p 8000:8000 \
 -p 8443:8443 \
 -p 8001:8001 \
 -p 8444:8444 \
 -p 8002:8002 \
 -p 8445:8445 \
 -p 8003:8003 \
 -p 8004:8004 \
 kong-custom-plugin:latest

But error occur, please see image below

How to run the my custom image with postgres image? Thank you for support.

Start your postgres image before the Kong and it should work. Make sure both are on the same network.

If you already have a old one, try starting from scratch.

Thanks,
John Williams
+91 87540 24090

| DUC_Nguyen_Viet_VTI
April 10 |

  • | - |

this is my Dockerfile

FROM kong/kong-gateway:3.1.1.2-alpine

USER root

RUN apk update

RUN apk add lua5.1 lua5.1-dev luarocks5.1

RUN apk add gcc expat expat-dev expat-static musl-dev

RUN luarocks install xml2lua 1.5-2

USER kong

WORKDIR /usr/local/share/lua/5.1/kong/plugins

COPY ./kong/plugins/ /usr/local/share/lua/5.1/kong/plugins

after created Dockerfile, i ran docker build command
docker build -t kong-custom-plugin --no-cache .

Finally, i run docker run command with param

-e “KONG_PLUGINS=bundled,myplugin” \

docker run -d --name kong-gateway-custom \
 --network=kong-net \
 -e “KONG_PLUGINS=bundled,myplugin” \
 -e "KONG_DATABASE=postgres" \
 -e "KONG_PG_HOST=kong-database" \
 -e "KONG_PG_USER=kong" \
 -e "KONG_PG_PASSWORD=kongpass" \
 -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_GUI_URL=http://localhost:8002" \
 -e KONG_LICENSE_DATA \
 -p 8000:8000 \
 -p 8443:8443 \
 -p 8001:8001 \
 -p 8444:8444 \
 -p 8002:8002 \
 -p 8445:8445 \
 -p 8003:8003 \
 -p 8004:8004 \
 kong-custom-plugin:latest

But error occur, please see image below

How to run the my custom image with postgres image? Thank you for support.

Thanks for support @JohnWilliams

i was resolve issue bootstrap database but i don’t find my custom plugin in kong manager
i was check api localhost:8001 and plugin was setting correct (image below)

What should I do fix it?
Do I need a license because I am using Kong Manager is running in Free Mode.

I was post issue in github: Can not find plugin in Kong Manager · Issue #6 · jeromeguillaume/kong-plugin-soap-xml-handling (github.com)

Yes, for some reason It does not show up in Kong Manager. But once you enable it via API and configure it for a route or service, it should. This may be a limitation with Free mode I guess. I havent really gotten to root cause on it.

Thanks,
John Williams
+91 87540 24090

| DUC_Nguyen_Viet_VTI
April 11 |

  • | - |

Thanks for support @JohnWilliams

i was resolve issue bootstrap database but i don’t find my custom plugin in kong manager
i was check api localhost:8001 and plugin was setting correct (image below)

What should I do fix it?
Do I need a license because I am using Kong Manager is running in Free Mode.

I was post issue in github: Can not find plugin in Kong Manager · Issue #6 · jeromeguillaume/kong-plugin-soap-xml-handling (github.com)