docker - Kong-返回的自定义插件:自定义插件已启用但未安装;

标签 docker dockerfile kong

我有一个使用内容运行Dockerfile的Kong实例:

FROM kong:1.4.0

WORKDIR /files
COPY plugins kong/plugins
ENV KONG_LOG_LEVEL=debug
ENV KONG_PLUGINS custom-plugin
ENV KONG_LUA_PACKAGE_PATH /files/?.lua;;

但是,在docker run上,这将返回
error loading plugin schemas: on plugin 'custom-plugin': custom-plugin plugin is enabled but not installed;

module 'kong.plugins.custom-plugin.handler' not found:No LuaRocks module found for kong.plugins.custom-plugin

我已经确认文件的结构正确,并且在运行时嵌套在kong / plugins目录中。

谁能帮助解决这个问题?

最佳答案

checkout 这些资源:

  • https://github.com/luarocks/luarocks/wiki/installation-instructions-for-unix
  • https://luarocks.org/
  • https://luarocks.org/modules/seifchen/kong-path-whitelist
  • https://github.com/Kong/kong/issues/4696

  • kong的错误报告: https://github.com/Kong/kong/issues/4696
    I don't think it's the luarocks' problem
    Indeed, I installed kong in docker whose image is built by a dockerfile.
    In my docker file, I went into the folder which store the custom plugins,and then traverse and luarocks make them by shell.It looks like:
    
    #install private plugins
    cd APIGPlugins
    
    for dir in `ls`; do
        if [ -d $dir ]; then
          cd $dir;
          luarocks make;
          cd ../;
        fi
    done
    and then, I run the docker images for a container by the directive:
    
    sudo docker run -d --name kong \
        -e "KONG_DATABASE=off" \
        -e "KONG_DECLARATIVE_CONFIG=/etc/kong/kong.yml" \
        -e "KONG_PLUGINS=apig-response-transform" \
        -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
        -p 8000:8000 \
        -p 8443:8443 \
        -p 8001:8001 \
        -p 8444:8444 \
        kong-plugin:v4
    As u see, I set the kong plugin by the docker run env variable parameter for enable the plugin instead of setting in the kong.conf.
    The logs were generated by directive of docker logs "container ID"
    It works when I tried to install another custom plugin in this way,but not work when install the custom plugin I described before
    

    更新资料

    您需要安装lua软件包管理器luarocks
  • Documentaton Link
  • Download Link
  • 关于docker - Kong-返回的自定义插件:自定义插件已启用但未安装;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58944475/

    相关文章:

    docker - 如何在 Airflow 中运行 bash 脚本?我需要将它们保存在哪个文件夹中?

    Dockerfile : add npm to an existing docker image

    bash - 在 $PATH Dockerfile 中找不到可执行文件

    kubernetes - 无法删除所有 Kubernetes 命名空间 Cronjob 中所有被驱逐的 pod

    kubernetes - Ingress 的 Istio 可编程路由

    cuda - 使用 docker 容器中的 GPU?

    docker - 当前基本设备 UUID : does not match with stored UUID:

    mysql - 如果我定义一个卷,Docker-compose 将不会启动 MySQL

    带有 --tag 的 Docker 构建命令无法标记图像

    http - 为什么基于主机 header 路由请求是代理流量的好方法?