skip to Main Content

I was using the following dockerfile to build a nginx docker image with some additional modules:

FROM nginx:mainline-alpine
RUN apk update
RUN apk add nginx-extras libnginx-mod-http-dav-ext libnginx-mod-http-auth-pam

This was successful in the past. But when I try to rebuild the image now I get this error:

 => [internal] load metadata for docker.io/library/nginx:mainline-alpine                                                                                                                                                                0.0s
 => [1/3] FROM docker.io/library/nginx:mainline-alpine                                                                                                                                                                                  0.0s
 => CACHED [2/3] RUN apk update                                                                                                                                                                                                         0.0s
 => ERROR [3/3] RUN apk add nginx-extras libnginx-mod-http-dav-ext libnginx-mod-http-auth-pam                                                                                                                                           0.7s
------
 > [3/3] RUN apk add nginx-extras libnginx-mod-http-dav-ext libnginx-mod-http-auth-pam:
#0 0.632 ERROR: unable to select packages:
#0 0.633   libnginx-mod-http-auth-pam (no such package):
#0 0.680     required by: world[libnginx-mod-http-auth-pam]
#0 0.680   libnginx-mod-http-dav-ext (no such package):
#0 0.680     required by: world[libnginx-mod-http-dav-ext]
#0 0.680   nginx-extras (no such package):
#0 0.680     required by: world[nginx-extras]

I can’t find any hint what has changed.
Is there another proper way to create a nginx docker container with additional modules installed?

2

Answers


  1. Try using Debian-based image?

    FROM nginx:stable-bullseye
    
    RUN apt-get update && apt-get install -y  nginx-extras  libnginx-mod-http-dav-ext libnginx-mod-http-auth-pam
    
    Login or Signup to reply.
  2. In alpine libnginx-mod-http-dav-ext calls nginx-mod-http-dav-ext (link), but I can’t find the same package for libnginx-mod-http-auth-pam. You can build or build it from sources.

    Alternative to it: use debian based images instead of alpine. Something like this:

    FROM nginx:mainline
    RUN apt clean && apt -y update && apt -y install --no-install-recommends nginx-extras && rm -rf /var/lib/apt/lists/*
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search