0

I am looking for some help in writing docker file for Ubuntu 18.04 version which installs Python3.10.

Currently it is written in such a way that it gets the default version of the Python3 (i.e. 3.6) along with the ubuntu 18.04.

Here the question is, is there any way that I can get the Python3.10 with Ubuntu 18.04? The requirement is to use either slim or non-slim versions of Python3.10 Bulls eye image from docker hub

2
  • Can you use the python:3.10 image without trying to reconstruct it (which your last sentence seems to imply)? Why that specific (4-year-old) distribution?
    – David Maze
    Dec 9, 2022 at 12:05
  • Thank you for your quick help David, could you please elaborate little bit on how can I include that in docker file (I have less knowledge with that part). Upgrading the Ubuntu to latest stable release is in pipe line and it could be taken up in next 6 months.
    – Suresh
    Dec 12, 2022 at 5:04

2 Answers 2

1

you can use ubuntu 18 docker image, then install python 3.10 inside it.

FROM ubuntu:18.04
RUN apt-get -y update && apt -get install software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa && apt install python3.10
1
  • Thank you Ali for sharing the information. But, I am looking to get the images from Python docker hub and not from private or third-party repos.
    – Suresh
    Dec 12, 2022 at 5:49
-3

I am able to build the image on ubuntu 18.04 by including python3.10

Step-1: Write a docker file FROM python:3.10-bullseye RUN mkdir WORK_REPO RUN cd WORK_REPO WORKDIR /WORK_REPO ADD hi.py . CMD ["python", "-u", "hi.py"]

Step-2: Build the image docker build -t image_name .

Step-3: Run the docker image docker run image_name

Step-4: Connect to the container and check the Python version

I hope this would be helpful for someone who is completely new in writing dockerfile.

Many Thanks, Suresh.

1
  • This is not what the OP asked for, which is install in ubuntu.
    – Robino
    Feb 25 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.