我在用多克做我的Laravel 项目.但我在安装PHP时出错.

我已经使用相同的配置运行过该项目一次,没有任何问题.

错误:

=> ERROR [14/26] RUN apt-get install -y     php8.1-fpm     php8.1-common     php8.1-curl     php8.1-mysql     php8.1-mbstring     php8.1-xml     php8.1-bcmath     php8.1-gd     php8.1-xdebug     php8.1-soap     php8  2.3s 
------
 > [14/26] RUN apt-get install -y     php8.1-fpm     php8.1-common     php8.1-curl     php8.1-mysql     php8.1-mbstring     php8.1-xml     php8.1-bcmath     php8.1-gd     php8.1-xdebug     php8.1-soap     php8.1-zip:       
#18 0.621 Reading package lists...
#18 1.822 Building dependency tree...
#18 2.008 Reading state information...
#18 2.106 Some packages could not be installed. This may mean that you have
#18 2.106 requested an impossible situation or if you are using the unstable
#18 2.106 distribution that some required packages have not yet been created
#18 2.106 or been moved out of Incoming.
#18 2.106 The following information may help to resolve the situation:
#18 2.106
#18 2.106 The following packages have unmet dependencies:
#18 2.255  php8.1-fpm : Depends: systemd but it is not going to be installed or
#18 2.255                        systemd-tmpfiles but it is not installable
#18 2.275 E: Unable to correct problems, you have held broken packages.
------
executor failed running [/bin/sh -c apt-get install -y     php8.1-fpm     php8.1-common     php8.1-curl     php8.1-mysql     php8.1-mbstring     php8.1-xml     php8.1-bcmath     php8.1-gd     php8.1-xdebug     php8.1-soap  
   php8.1-zip]: exit code: 100

我的文档文件:

#------------- Setup Environment -------------------------------------------------------------

# Pull base image
FROM ubuntu:18.04
ENV TZ=America/Sao_Paulo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install common tools 
RUN apt-get update
RUN apt-get install -y wget curl nano htop git unzip bzip2 software-properties-common locales

# Set evn var to enable xterm terminal
ENV TERM=xterm

# Set working directory
WORKDIR /var/www/html

COPY . ./

# Add repositories
RUN LC_ALL=C.UTF-8 apt-add-repository ppa:ondrej/php
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
RUN echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
RUN echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list

RUN apt-get update

#------------- Application Specific Stuff ----------------------------------------------------

# Install PHP
RUN apt-get update
RUN apt-get install -y \
    php8.1-fpm \ 
    php8.1-common \ 
    php8.1-curl \ 
    php8.1-mysql \ 
    php8.1-mbstring \ 
    php8.1-xml \
    php8.1-bcmath \
    php8.1-gd \
    php8.1-xdebug \
    php8.1-soap \
    php8.1-zip   

RUN echo "xdebug.mode=develop" >> /etc/php/8.1/mods-available/xdebug.ini

#------------- FPM & Nginx configuration ----------------------------------------------------

# Config fpm to use TCP instead of unix socket
ADD docker/www.conf /etc/php/8.1/fpm/pool.d/www.conf
RUN mkdir -p /var/run/php

# Install Nginx
RUN apt-get install -y nginx

ADD docker/game /etc/nginx/sites-enabled/

ADD docker/nginx.conf /etc/nginx/

#------------- Composer & laravel configuration ----------------------------------------------------

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

#------------- Supervisor Process Manager ----------------------------------------------------

# Install supervisor
RUN apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
ADD docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

#------------- Container Config ---------------------------------------------------------------
ARG ENV_KEY=dev

COPY ./.${ENV_KEY}.env ./.env

RUN chown -R www-data:www-data ./

# Expose port 80
EXPOSE 80

# Set supervisor to manage container processes
ENTRYPOINT ["/usr/bin/supervisord"]

我已经用docker system prune -a清除了对讲机设置.我还卸载并安装了docker.

对我如何解决这个问题有什么建议吗?

推荐答案

自从8月2日以来,我就遇到了同样的问题,看起来ondrej/php库出了问题. 首先,我try 按照@mataslauriti的建议安装systemd,但出现了以下错误:

The following packages have unmet dependencies:
[07:33:33]#24 7.480  systemd : Depends: libsystemd0 (= 237-3ubuntu10.53) but 237-3ubuntu10.54 is to be installed

该问题已通过将以下内容添加到sources.list中得到解决:

RUN echo "deb http://archive.ubuntu.com/ubuntu/ bionic-proposed main" >> /etc/apt/sources.list

您不需要显式安装systemd,它将作为php依赖项之一安装.

Laravel相关问答推荐

为什么在Blade 文件中输出用户通知时出现错误?

Laravel中的策略对我不起作用,这是我的代码

AJAX响应中未定义的全名

如何在 Laravel 的外部 js 文件中包含 csrf_token()?

为什么命令php artisan serve不起作用

Laravel 5.7 判断Electron邮件是否经过验证

Laravel Auth::attempt() 返回 false

Heroku 上的 Laravel 队列工作者

PHP 中的 Http 响应代码枚举

在 Laravel 中显示已注册的路由

Laravel 5 与 Postgresql

无法打开laravel.log:无法打开流

Laravel 存储链接不适用于生产

Guzzle 返回流空体而不是 json 体

Laravel 接口

将 Laravel 集合排序为 ID 数组

Laravel 获取文件内容

Laravel X-CSRF-Token 与 POSTMAN 不匹配

如何在不要求用户登录 Laravel 的情况下验证Electron邮件

限制自己重载外部 API 的速率