How to build Python3 docker image using linux

In this post, We will build the python3 docker image, Use the following command for the same.

Step 1: Create a Dockerfile

You need to create a Dockerfile using any text editor like vim.

vim Dockerfile

Step 2: Paste the following command.

FROM ubuntu
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get install -y python3.8
RUN ln -s /usr/bin/python3.8 /usr/bin/python
RUN apt-get install -y python3-pip

Step 3: Execute the docker build command

In order to execute the docker build command you need to use the following command for the same.

sudo docker build . -t mypython3:latest

Conclusion

We have successfully build Python3 docker image using linux, Kindly report in case you are facing difficulties with following details.

  • OS name
  • OS version
  • Package name
  • Logs – Error / Warning / failed
How to build Python3 docker image using linux

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top