我使用以下dockerfile来构建一个带有一些额外模块的nginx docker映像:
FROM nginx:mainline-alpine
RUN apk update
RUN apk add nginx-extras libnginx-mod-http-dav-ext libnginx-mod-http-auth-pam
这在过去是成功的。但是当我尝试重建图像时,现在我得到了这个错误:
=> [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]
我找不到任何变化的迹象。是否有另一种合适的方法来创建一个nginx docker容器与额外的模块安装?
尝试使用基于debian的图像?
FROM nginx:stable-bullseye
RUN apt-get update && apt-get install -y nginx-extras libnginx-mod-http-dav-ext libnginx-mod-http-auth-pam
在alpinelibnginx-mod-http-dav-ext
调用nginx-mod-http-dav-ext
(链接),但我找不到libnginx-mod-http-auth-pam
的相同包。您可以构建或从源代码构建它。
替代方案:使用基于debian的映像而不是alpine。像这样:
FROM nginx:mainline
RUN apt clean && apt -y update && apt -y install --no-install-recommends nginx-extras && rm -rf /var/lib/apt/lists/*