Skip to content

build extend module with nginx docker is error #980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
freshgeek opened this issue Apr 21, 2025 · 4 comments
Open

build extend module with nginx docker is error #980

freshgeek opened this issue Apr 21, 2025 · 4 comments
Labels

Comments

@freshgeek
Copy link

Bug Overview

When I use a third-party module and there is no deb package, building an image will report an error. Here is the replication operation

mkdir -p ngx_waf

wget -O Dockerfile https://raw.githubusercontent.com/nginx/docker-nginx/refs/heads/master/modules/Dockerfile
 echo 'https://github.com/ADD-SP/ngx_waf/archive/refs/tags/v6.1.10.tar.gz' > ngx_waf/source
 
echo 'flex bison' > ngx_waf/build-deps
 
echo '' > ngx_waf/prebuild && chmod +x ngx_waf/prebuild 
 
 tree ngx_waf
 
docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx .



Here is the error log:

1.631 Fetched 9307 kB in 1s (6677 kB/s)
1.631 Reading package lists...
2.349 Reading package lists...
3.077 E: Unsupported file /tmp/packages/nginx-module-ngxwaf_1.27.5*.deb given on commandline
------
Dockerfile:73
--------------------
  72 |     FROM ${NGINX_FROM_IMAGE}
  73 | >>> RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder \
  74 | >>>     apt-get update \
  75 | >>>     && . /tmp/packages/modules.env \
  76 | >>>     && for module in $BUILT_MODULES; do \
  77 | >>>            apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb; \
  78 | >>>        done \
  79 | >>>     && rm -rf /var/lib/apt/lists/
  80 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update     && . /tmp/packages/modules.env     && for module in $BUILT_MODULES; do            apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb;        done     && rm -rf /var/lib/apt/lists/" did not complete successfully: exit code: 100

Expected Behavior

1

Steps to Reproduce the Bug

1

Environment Details

docker

Additional Context

No response

@freshgeek freshgeek added the bug label Apr 21, 2025
@freshgeek
Copy link
Author

Is it an expected behavior? Or provide new features built without deb packages

@thresheek
Copy link
Member

Hi @freshgeek

This probably means that the build failed. You should examine the full log output.

@freshgeek
Copy link
Author

Yes, he failed to build. I copied the complete logs over, but the existing logs can explain the situation. Currently, modules without deb cannot be installed @thresheek

@freshgeek
Copy link
Author

[root@fand ~]# docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx .
[+] Building 66.4s (9/9) FINISHED                                                                                                                                    docker:default
 => [internal] load build definition from Dockerfile                                                                                                                           0.0s
 => => transferring dockerfile: 4.23kB                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/nginx:mainline                                                                                                              1.8s
 => [internal] load .dockerignore                                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                                0.0s
 => [internal] load build context                                                                                                                                              0.1s
 => => transferring context: 251.16kB                                                                                                                                          0.0s
 => CACHED [stage-1 1/2] FROM docker.io/library/nginx:mainline@sha256:5ed8fcc66f4ed123c1b2560ed708dc148755b6e4cbd8b943fab094f2c6bfa91e                                         0.0s
 => [builder 2/4] RUN if [ "ngx_waf" = "" ]; then         echo "No additional modules enabled, exiting";         exit 1;     fi                                                0.3s
 => [builder 3/4] COPY ./ /modules/                                                                                                                                            0.0s
 => [builder 4/4] RUN apt-get update     && apt-get install -y --no-install-suggests --no-install-recommends                 patch make wget git devscripts debhelper dpkg-d  61.0s
 => ERROR [stage-1 2/2] RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder     apt-get update     && . /tmp/packages/modules.env     && for modul  3.2s 
------                                                                                                                                                                              
 > [stage-1 2/2] RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder     apt-get update     && . /tmp/packages/modules.env     && for module in $BUILT_MODULES; do            apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_1.27.5*.deb;        done     && rm -rf /var/lib/apt/lists/:                                                                                                                                                                                  
0.251 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]                                                                                                                
0.267 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]                                                                                                       
0.267 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
0.355 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8792 kB]
0.496 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [512 B]
0.618 Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [260 kB]
1.657 Fetched 9307 kB in 1s (6604 kB/s)
1.657 Reading package lists...
2.381 Reading package lists...
3.094 E: Unsupported file /tmp/packages/nginx-module-ngxwaf_1.27.5*.deb given on commandline
------
Dockerfile:73
--------------------
  72 |     FROM ${NGINX_FROM_IMAGE}
  73 | >>> RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder \
  74 | >>>     apt-get update \
  75 | >>>     && . /tmp/packages/modules.env \
  76 | >>>     && for module in $BUILT_MODULES; do \
  77 | >>>            apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb; \
  78 | >>>        done \
  79 | >>>     && rm -rf /var/lib/apt/lists/
  80 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update     && . /tmp/packages/modules.env     && for module in $BUILT_MODULES; do            apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb;        done     && rm -rf /var/lib/apt/lists/" did not complete successfully: exit code: 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants