JP Cubero
JP Cubero

Reputation: 1

Installation of php8.1 with a Docker

I'm trying to install php8.1 and composer with a dockerfile but it returns some errors of unfound packages. What I have to do to solve my problem?

[****@#### 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

Here is my dockerfile:

# PHP app
FROM php:8.1 as php-builder

# Actualizar el sistema e instalar las dependencias necesarias
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

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

# Install dependencies file
COPY composer*.json ./

# Install dependencies
RUN composer install

# --------------------------------------------------------

# Node app with npm dependencies
FROM node:18.11.0-slim


COPY --from=php-builder /app /usr/src/app

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./

# Install dependencies
RUN npm install

# Bundle app source
COPY . .


EXPOSE 5173


CMD [ "npm", "run", "build" ]

Upvotes: 0

Views: 1427

Answers (1)

sb 007
sb 007

Reputation: 52

Some versions of Debian are a little behind the times... You could try adding this to your Dockerfile before doing your install

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

Upvotes: 0

Related Questions