Skip to content
Advertisement

Docker image: Unable to locate package php7.2

I have had a bitbucket pipeline setup which had been working flawlessly for a year yet it stopped working few days ago

Here is the beginning of my bitbucket config

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
...
...

Now I keep getting the following error (that has not happened before):

+ 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'

I could not find any changes on the docker image end and ondrej’s repo seems to still contain the packages. What could be the problem?

Advertisement

Answer

atlassian/default-image:2 is based on ubuntu16.04(xenial), but its end of life is Apr 2021.

From ppa:ondrej/php home page we could see next:

Don’t ask for end-of-life PHP versions or Ubuntu release, they won’t be provided.

This means the owner have removed the support for ubuntu16.04, this is why you can’t install php7.2 on ubuntu16.04.

For you, go to PPA to find another php7.2 ppa, e.g. ppa:jason.grammenos.agility/php, then next could resolve your problem:

$ 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
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement