nginx / nginx/docker-nginx

build extend module with nginx docker is error

Open
#980 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Shell
Stars
3.5k
Forks
1.8k
Avg merge
42m
Merged PRs (30d)
2

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with modules/Dockerfile, especially the package installation loop at lines 73-79, then run the reproduction using ngx_waf/source and ngx_waf/build-deps. Compare the generated files under /tmp/packages with the requested module name and verify that building an image with a third-party module without a Debian package completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, shell
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.