shared lib fails to load at nginx docker

216 views Asked by At

We used this dockerfile out of this link - https://github.com/nginxinc/docker-nginx/blob/master/mainline/alpine/Dockerfile

And included to install this extra module - nginx-mod-http-lua and docker image was built successfully, We confirm that required modules exists

docker exec -it 3d69e289b253 /bin/sh
/ # ls /etc/nginx/modules/ngx_http_js_module.so
/etc/nginx/modules/ngx_http_js_module.so
/ # ls /etc/nginx/modules/ngx_http_js_module.so
/etc/nginx/modules/ngx_http_js_module.so
/ # ls /etc/nginx/modules/ngx_http_lua_module.so
/etc/nginx/modules/ngx_http_lua_module.so
/ #

Our nginx.conf contains this :

env ACME_KEY;
load_module modules/ngx_http_js_module.so;
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_lua_module.so;

events {}

http {
    js_import http.js;

    server {
        listen 8081;

        location / {
            js_content http.invalid_resource;
        }

        location /healthz {
            js_content http.healthz_resource;
        }

        location /acme {
            set_by_lua get_api_key  'return os.getenv("ACME_KEY")';
            proxy_set_header API-Key $get_api_key;
            proxy_pass https://acme.example.com/;
        }
    }
}

We started the docker container with nginx.conf volume mapping, and docker container fails to start with this below error, any resolution to fix this ?


2023/08/24 21:42:22 [emerg] 1#1: dlopen() "/etc/nginx/modules/ngx_http_js_module.so" failed (Error loading shared library /etc/nginx/modules/ngx_http_js_module.so: No such file or directory) in /etc/nginx/nginx.conf:2
nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_js_module.so" failed (Error loading shared library /etc/nginx/modules/ngx_http_js_module.so: No such file or directory) in /etc/nginx/nginx.conf:2
0

There are 0 answers