gpt4 book ai didi

php - 将Dockerfile从php:7.2-fpm更新到php:7.3-fpm时出错

转载 作者:行者123 更新时间:2023-12-02 21:06:22 24 4
gpt4 key购买 nike

因为我想要PHP 7.3的功能,所以我试图将项目从PHP 7.2更新到PHP 7.3。在docker-compose.yml中,我有:

php:
build: ./docker/php
volumes:
- .:/var/www/html
links:
- mysql:mysql
depends_on:
- mysql
networks:
- pimcorenet

我的Dockerfile是这样的:
FROM php:7.2-fpm

# install git
RUN apt-get update && \
apt-get install -y --no-install-recommends git

#install some base extensions
RUN apt-get install -y \
zlib1g-dev \
zip \
libpng-dev \
exiftool \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libicu-dev \
libpq-dev \
libxpm-dev \
libvpx-dev \
mariadb-client \
libxml2-dev

RUN docker-php-ext-install -j$(nproc) \
zip \
exif \
bcmath \
intl \
pcntl \
mysqli \
pdo \
gd \
pdo_mysql \
pdo_pgsql \
mbstring \
soap \
opcache \
iconv

# Install Imagick
RUN apt-get update && apt-get install -y \
libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick

# Install Composer
RUN echo "Install Composer"
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer --version

我收到以下错误:

E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/r/readline/readline-common_7.0-5_all.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/j/jquery/libjs-jquery_3.3.1~dfsg-3_all.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/f/freetype/freetype2-doc_2.9.1-3_all.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/i/icu/icu-devtools_63.1-6_amd64.deb Could not resolve 'cdn-fastly.deb.debian.org' E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/j/javascript-common/javascript-common_11_all.deb Could not resolve 'cdn-fastly.deb.debian.org' ..... more errors

ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get install -y zlib1g-dev zip libpng-dev
exiftool libfreetype6-dev libjpeg62-turbo-dev
libmcrypt-dev libicu-dev libpq-dev libxpm-dev libvpx-dev mariadb-client libxml2-dev' returned a non-zero code: 100



确切的问题是什么?是因为某些必需的PHP扩展名尚不适用于PHP 7.3还是已被替换?我该如何解决?刚刚将 FROM php:7.2-fpm更改为 FROM php:7.3-fpm

最佳答案

您无法使用grok容器。因此,您采用了错误的方法。

您不应该尝试将php 7.2“升级”到容器到7.3。

首先,您应该基于7.3创建一个新的容器镜像。

顺便说一句,我建议我为您现有的7.2容器(即新的Dockerfile)提供新的单独服务,而不是仅更改现有的容器/ Dockerfile。这样一来,您就可以同时测试这两个版本,而不必进行“信仰飞跃”的转换。

另外,我建议直接构建Debian或Ubuntu镜像,而不要遍历“官方” Docker镜像。从Docker的意义上讲,它们只是官方的,但在我看来它们并没有得到很好的支持。

这是我当前正在使用的dockerfile:https://github.com/Danack/example/blob/master/docker/php_fpm/Dockerfile将7.2切换到7.3应该可以正常工作。

关于php - 将Dockerfile从php:7.2-fpm更新到php:7.3-fpm时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57772955/

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