Home > Net >  Issue with the installation of Python 3.8 with docker file
Issue with the installation of Python 3.8 with docker file

Time:07-21

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.

CodePudding user response:

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.

CodePudding user response:

As an alternative you could always consider using one of the official python docker images, rather than installing python on top of an ubuntu image yourself.

python:3.8-buster or python:3.8-slim-buster may be close enough to what you need?

  • Related