使用Docker安装php8.1

dsf9zpds  于 2023-04-19  发布在  PHP
关注(0)|答案(1)|浏览(342)

我尝试使用dockerfile安装php8.1和composer,但它返回了一些未找到的包的错误。我必须做些什么来解决我的问题?

[****@#### picture-this-web]$ docker build -t project:0.2 .
Sending build context to Docker daemon  4.291MB
Step 1/13 : FROM php:8.1 as php-builder
 ---> 5478436e6090
Step 2/13 : RUN apt-get update && apt-get install -y     curl unzip php8.1 php8.1-cli php8.1-mbstring php8.1-xml php8.1-zip php8.1-json php8.1-curl
 ---> Running in 49d1b6f54b44
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [237 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB]
Fetched 8643 kB in 1s (6084 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php8.1
E: Couldn't find any package by glob 'php8.1'
E: Couldn't find any package by regex 'php8.1'
E: Unable to locate package php8.1-cli
E: Couldn't find any package by glob 'php8.1-cli'
E: Couldn't find any package by regex 'php8.1-cli'
E: Unable to locate package php8.1-mbstring
E: Couldn't find any package by glob 'php8.1-mbstring'
E: Couldn't find any package by regex 'php8.1-mbstring'
E: Unable to locate package php8.1-xml
E: Couldn't find any package by glob 'php8.1-xml'
E: Couldn't find any package by regex 'php8.1-xml'
E: Unable to locate package php8.1-zip
E: Couldn't find any package by glob 'php8.1-zip'
E: Couldn't find any package by regex 'php8.1-zip'
E: Unable to locate package php8.1-json
E: Couldn't find any package by glob 'php8.1-json'
E: Couldn't find any package by regex 'php8.1-json'
E: Unable to locate package php8.1-curl
E: Couldn't find any package by glob 'php8.1-curl'
E: Couldn't find any package by regex 'php8.1-curl'
The command '/bin/sh -c apt-get update && apt-get install -y     curl unzip php8.1 php8.1-cli php8.1-mbstring php8.1-xml php8.1-zip php8.1-json php8.1-curl' returned a non-zero code: 100

下面是我的dockerfile:

  • PHP应用 *

从php:8.1作为php-builder

  • Actualizar el sistema e instalar las dependencias necessarias *

运行apt-get update && apt-get install -y \ curl unzip php8.1 php8.1-cli php8.1-mbstring php8.1-xml php8.1-zip php8.1-json php8.1-curl

  • #安装Composer*

RUN curl -sS https://getcomposer.org/installer|/usr/local/bin --filename=composer

  • #安装依赖文件 *

COPY composer*.json ./

  • #安装依赖项 *

RUN编写器安装

------------------------------------------------------------

  • #npm依赖的Node应用 *

FROM节点:18.11.0-slim
复制--from=php-builder /app /usr/src/app

  • #创建app目录 *

/usr/src/app

  • #安装应用依赖 *

COPY package*.json ./

  • #安装依赖项 *

运行npm install

  • #捆绑app源 *

复制。
EXPOSE 5173
CMD [“npm”,“run”,“build”]

myzjeezk

myzjeezk1#

Debian的某些版本有点落后于时代...你可以在安装之前尝试将其添加到你的Dockerfile中

RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list

相关问题