Having newb trouble installing plugins in kong docker

I’m trying to install a custom plugin into my kong docker. From what I’ve read, and the errors I’ve had so far, the easiest way to do it is to extend the kong Dockerfile with my own.

I’ve done this as the following:

FROM kong:0.13.1

LABEL maintainer="Me <someemailaddress>"

RUN luarocks install middleman

However, when I try (using docker compose) to start this up, I get the following:

$ KONG_VERSION=0.13 docker-compose up

Building kong

Step 1/3 : FROM kong:0.13.1

 ---> fa59ec12ab55

Step 2/3 : LABEL maintainer="Me <someemailaddress>"

 ---> Using cache

 ---> 47357c958a0d

Step 3/3 : RUN luarocks install middleman

 ---> Running in 618aaa0ccd62

Warning: The directory '/root/.cache/luarocks' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing /usr/local/bin/luarocks with sudo, you may want sudo's -H flag.

Installing https://luarocks.org/middleman-0.1.0-1.rockspec

Error: Error fetching file: Failed downloading https://luarocks.org/middleman-0.1.0-1.rockspec - middleman-0.1.0-1.rockspec

ERROR: Service 'kong' failed to build: The command '/bin/sh -c luarocks install middleman' returned a non-zero code: 1

I am a complete Docker newb and but I have got this far only to fail :frowning: Anyone got any hints on how to get this working, or generally how to install plugins into Kong on Docker?

Error: Error fetching file: Failed downloading https://luarocks.org/middleman-0.1.0-1.rockspec - middleman-0.1.0-1.rockspec

Are you sure the host running these commands can reach luarocks and there are not firewall rules in place preventing it?

Thanks for the reply! I have no firewall that I know of. Is the host the docker container or my machine running it? Like I say, I’m a complete newbie at this.

With a little help from a colleague, I’v had to do the following:

FROM kong:0.13.1

LABEL maintainer="ThoughtRiver Dev <thoughtriverdev@thoughtriver.com>"

RUN apk update && apk add git gcc

RUN git clone https://github.com/pantsel/kong-middleman-plugin middleman && \

cd middleman && \

luarocks make *.rockspec

It’s a problem with the actual plugin I think as all things other than where luarocks thinks the plugin is, work fine.


What I see problem with luarocks install middleman is their versions are mismatched.

Plugins latest version as per git hub is 0.1.1-1 and https://luarocks.org/modules/pantsel/middleman reports it as 0.1.0-1

It should work if luarocks.org updates its version. I believe :slight_smile:

1 Like