Install a custom plugin with Kong in a Docker

Hello everyone, I’m a student in IT and I am starting with KONG and Docker. That’s why I have some little issues. Is someone would like to answer them ?

I tried to create a custom plugin for Kong. I am not sure about how I did it, but it is working (thanks to hello world plugin example). I did everything on Linux Ubuntu. But now I would like to export this plugin for a Kong contained in a Docker. I followed the instructions for installing the plugin with luarocks but for the last step, I need to add my custom plugin the Kong’s configuration. I don’t know where I can add it and how I can restart Kong to use theses changes.

Hello i3yaki,

Your question is more related with Docker than with Kong.

The best way to do what you are suggesting is creating your own Dockerfile.

Kong’s Dockerfile for alpine executes some commands. You need your version of kong to execute one additional command (installing your plugin via luarocks).

You could just copy the file I linked above and just add the missing command, and that would probably work, but a more “dockerish” way to do it would be declaring that your dockerfile uses the kong image as a parent image (you do this by using the FROM directive in your Dockerfile) . Then you could add the luarocks command to install your plugin. You would then have to use that Dockerfile to run kong instead of the default one.

1 Like

Thanks for the answer, I’ll try it after some changes in my plugins. :slight_smile:

I was looking for the way to install already available custom pligins such as kong-spec-expose on top of default kong docker image

I use Kong Docker Image with docker bind mount volumes to link my custom plugins and ZeroBrane Studio for debugging and development

Is there any update on that? Could you please share your experience regarding custom plugin?

If you are trying to install Lua plugin, you can check this video