Saturday, July 23, 2022

[SOLVED] Issue with the installation of Python 3.8 with docker file

Issue

I am trying to update my CI Pipeline for git lab, but my pipeline keeps on failing because the docker in docker of my runner fails to install python 3.8.

In my Docker file I am running the following commands

FROM ubuntu:latest

ENV http_proxy $HTTPS_PROXY
ENV https_proxy $HTTPS_PROXY
RUN apt-get update && apt-get install -y \
  python3.8 \
  python3-pip \
  && rm -rf /var/lib/apt/lists/*

but my pipeline fails giving me the following error

Package python3.8 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'python3.8' has no installation candidate

error building image: error building stage: failed to execute command: waiting for process to exit: exit status 100

In many suggestions I have found the using the apt-get update command should solve the problem however that is not working for me.


Solution

Latest Ubunt repos don't contain old Python versions by default.

You can either try using a newer Python version or adding the deadsnakes repo with something like this:

FROM ubuntu:latest

ENV http_proxy $HTTPS_PROXY
ENV https_proxy $HTTPS_PROXY

RUN apt-get install -y software-properties-common && sudo add-apt-repository ppa:deadsnakes/ppa && apt-get update && apt-get install -y \
  python3.8 \
  python3-pip \
  && rm -rf /var/lib/apt/lists/*

You may also need to apt update before installing the software-properties-common package.



Answered By - Juan González
Answer Checked By - Cary Denson (WPSolving Admin)