Docker镜像: 无法找到php7.2软件包。

3

我曾经设置了一条Bitbucket Pipeline,它已经完美地运作了一年,但是几天前它突然停止工作了。

这是我的Bitbucket配置的开头:

image: atlassian/default-image:2

options:
  max-time: 30
pipelines:
  default:
    - step:
        script:
          - echo "This script runs on all branches that don't have any specific pipeline assigned in 'branches'."
  branches:
    master:
      - step:
          caches:
            - composer
          name: cms
          deployment: production
          script:
            - apt-get update
            - apt-get install -y software-properties-common python-software-properties
            - add-apt-repository -y ppa:ondrej/php
            - apt-get update
            - apt-get install -y php7.2 php7.2-cli php7.2-common php7.2-mbstring
            - apt-get install -y php7.2-curl php7.2-xml
...
...

现在我一直收到以下错误(之前从未出现过):

+ apt-get install -y php7.2 php7.2-cli php7.2-common php7.2-mbstring
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.2
E: Couldn't find any package by regex 'php7.2'
E: Unable to locate package php7.2-cli
E: Couldn't find any package by regex 'php7.2-cli'
E: Unable to locate package php7.2-common
E: Couldn't find any package by regex 'php7.2-common'
E: Unable to locate package php7.2-mbstring
E: Couldn't find any package by regex 'php7.2-mbstring'

我在 Docker 镜像端和 ondrej 的 repo 中均未发现任何更改,可能的问题是什么呢?


这个使用的是哪个Debian / Ubuntu镜像?你能否使用其中一个官方PHP 7.2镜像 - Phil
@phil 我正在使用 atlassian/default-image:2(应该是Ubuntu 16.04)。我找不到适用于PHP 7.2的Ubuntu镜像。 - Denis
php:7.2-cli 是官方的 Debian 镜像。 - Phil
1个回答

16

atlassian/default-image:2基于Ubuntu 16.04(Xenial),但其生命周期已于2021年4月结束。

ppa:ondrej/php首页可以看到以下内容:

不要要求终止生命周期的PHP版本或Ubuntu发行版,它们将不会提供。

这意味着该所有者已删除对Ubuntu 16.04的支持,这就是您无法在Ubuntu 16.04上安装php7.2的原因。

因此,您可以前往PPA查找另一个php7.2 ppa,例如ppa:jason.grammenos.agility/php,然后就能解决您的问题了:

$ add-apt-repository -y ppa:jason.grammenos.agility/php
$ apt-get update
$ apt-cache policy php7.2
php7.2:
  Installed: (none)
  Candidate: 7.2.15-1+ubuntu16.04.1+deb.sury.org+1
  Version table:
     7.2.15-1+ubuntu16.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/jason.grammenos.agility/php/ubuntu xenial/main amd64 Packages
$ apt-get install -y php7.2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接