You are browsing documentation for an outdated version. See the latest documentation here.
Use Plugins With Containers
Use external plugins in container and Kubernetes
To use plugins requiring external plugin servers, both the plugin servers and the plugins themselves need to be installed inside the Kong Gateway container, copy or mount the plugin’s source code into the Kong Gateway container.
Note: Official Kong Gateway images are configured to run as the
nobodyuser. When building a custom image, to copy files into the Kong Gateway image, you must temporarily set the user toroot.
This is an example Dockerfile that explains how to mount your plugin in the Kong Gateway image:
FROM kongUSER root# Example for GO:COPY your-go-plugin /usr/local/bin/your-go-plugin# Example for JavaScript:RUN apk update && apk add nodejs npm && npm install -g kong-pdkCOPY your-js-plugin /path/to/your/js-plugins/your-js-plugin# Example for Python# PYTHONWARNINGS=ignore is needed to build gevent on Python 3.9RUN apk update && \apk add python3 py3-pip python3-dev musl-dev libffi-dev gcc g++ file make && \PYTHONWARNINGS=ignore pip3 install kong-pdkCOPY your-py-plugin /path/to/your/py-plugins/your-py-plugin# reset back the defaultsUSER kongENTRYPOINT ["/docker-entrypoint.sh"]EXPOSE 8000 8443 8001 8444STOPSIGNAL SIGQUITHEALTHCHECK --interval=10s --timeout=10s --retries=10 CMD kong healthCMD ["kong", "docker-start"]