skip to Main Content

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

Answers


  1. Chosen as BEST ANSWER

    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.


  2. 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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search