gpt4 book ai didi

docker - 错误 : unsatisfiable constraints - on php:7-fpm-alpine

转载 作者:IT老高 更新时间:2023-10-28 21:41:21 25 4
gpt4 key购买 nike

我正在考虑在 fpm-alpine 容器上设置 laravel。遇到以下 Dockerfile 产生一些错误的障碍......

FROM php:7-fpm-alpine

# install extensions needed for Laravel
RUN apk --update add \
php7-mysqli \
php7-mcrypt \
php7-mbstring \
rm /var/cache/apk/*

产生的错误是:

Building fpm
Step 1 : FROM php:7-fpm-alpine
---> 9e6811cb8bac
Step 2 : RUN apk --update add php7-mysqli php7-mcrypt php7-mbstring rm /var/cache/apk/*
---> Running in 87364957eb57
fetch http://dl-cdn.alpinelinux.org/alpine/v3.3/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.3/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
/var/cache/apk/* (missing):
required by: world[/var/cache/apk/*]
php7-mbstring (missing):
required by: world[php7-mbstring]
php7-mcrypt (missing):
required by: world[php7-mcrypt]
php7-mysqli (missing):
required by: world[php7-mysqli]
rm (missing):
required by: world[rm]
ERROR: Service 'fpm' failed to build: The command '/bin/sh -c apk --update add php7-mysqli php7-mcrypt php7-mbstring rm /var/cache/apk/*' returned a non-zero code: 5

我可以搜索这些包名和find them on the alpine linux web site .关于如何解决这个问题的任何想法?好像它没有更新 apt 缓存...但是添加一个 LS 我可以在那里看到内容:

Building fpm
Step 1 : FROM php:7-fpm-alpine
---> 9e6811cb8bac
Step 2 : RUN apk update
---> Using cache
---> 9ef09f3aa2a2
Step 3 : RUN ls /var/cache/apk
---> Running in e126a083a306
APKINDEX.5a59b88b.tar.gz
APKINDEX.7c1f02d6.tar.gz

有什么想法可以解决这个问题吗?

最佳答案

基础 Docker 镜像可能引用了不正确的存储库。

将正确的存储库传递给 apk add 命令,如下所示:

RUN apk add --update \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
php7-mysqli php7-mcrypt php7-mbstring

关于docker - 错误 : unsatisfiable constraints - on php:7-fpm-alpine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36530620/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com