Skip to content

Instantly share code, notes, and snippets.

@monkut
Last active June 14, 2023 20:31
Show Gist options
  • Star 71 You must be signed in to star a gist
  • Fork 21 You must be signed in to fork a gist
  • Save monkut/c4c07059444fd06f3f8661e13ccac619 to your computer and use it in GitHub Desktop.
Save monkut/c4c07059444fd06f3f8661e13ccac619 to your computer and use it in GitHub Desktop.
Base Docker image for ubuntu-16.04 & Python3.6
# docker build -t ubuntu1604py36
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv
RUN apt-get install -y git
# update pip
RUN python3.6 -m pip install pip --upgrade
RUN python3.6 -m pip install wheel
@b0g3r
Copy link

b0g3r commented May 11, 2018

vim? why?

@xBartu
Copy link

xBartu commented May 13, 2018

@b0g3r you do not need many of the settings here. Basically, you can ignore vim, git etc. Even pip you may not need.

@sergsoares
Copy link

Thanks, help me try to get out docker compose to learn more about docker, using a simple Dockerfile to resolve.

@shaoeChen
Copy link

thanks, it really very very base docker image for python 3.6 !

@vrishaligiri
Copy link

RUN add-apt-repository ppa:jonathonf/python-3.6
 ---> Running in f7ecf56ba324
Cannot add PPA: 'ppa:~jonathonf/ubuntu/python-3.6'.
ERROR: '~jonathonf' user or team does not exist.
The command '/bin/sh -c add-apt-repository ppa:jonathonf/python-3.6' returned a non-zero code: 1

@adammenges
Copy link

cheers

@AlekKras
Copy link

Slightly modified and better working Dockerfile would be as follow:


# docker build -t ubuntu1604py36
FROM ubuntu:16.04

RUN apt-get update && \
        apt-get install -y software-properties-common vim
        add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update -y

RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv && \
        apt-get install -y git

# update pip
RUN python3.6 -m pip install pip --upgrade && \
        python3.6 -m pip install wheel

@desprit
Copy link

desprit commented Jan 7, 2019

RUN apt-get update &&
apt-get install -y software-properties-common vim
add-apt-repository ppa:jonathonf/python-3.6

Should be

RUN apt-get update && \
  apt-get install -y software-properties-common vim && \
  add-apt-repository ppa:jonathonf/python-3.6

@luvvien
Copy link

luvvien commented Oct 18, 2019

I don't think it is a good choice with too many RUN commands, because it will create too many file layers. Plz check with the following code:

FROM ubuntu:16.04

RUN apt-get update && \
        apt-get install -y software-properties-common && \
        add-apt-repository ppa:jonathonf/python-3.6 && \
        apt-get update -y  && \
        apt-get install -y build-essential python3.6 python3.6-dev python3-pip && \
        apt-get install -y git  && \
        # update pip
        python3.6 -m pip install pip --upgrade && \
        python3.6 -m pip install wheel

@alexmaccabi
Copy link

Its no good now.
ppa:jonathonf was removed by the developer.
https://launchpad.net/~jonathonf

@tangcongyuan
Copy link

Its no good now.
ppa:jonathonf was removed by the developer.
https://launchpad.net/~jonathonf

I just found out the same thing.
Updated my script to ppa:deadsnakes/ppa.

@dodo-347
Copy link

Cannot add PPA: 'ppa:~deadsnakes/ubuntu/ppa'.
ERROR: '~deadsnakes' user or team does not exist.
The command '/bin/sh -c add-apt-repository ppa:deadsnakes/ppa' returned a non-zero code: 1

What other PPA can I use here? Any help on this is appreciated.
Thanks in Advance

@nguyenthaison
Copy link

nguyenthaison commented Apr 11, 2020

@arunkumarchan
U can try:
add-apt-repository ppa:deadsnakes/ppa

@Praveenk8051
Copy link

Env variable in not set in this ..
how can i set it ?

@maisonhai3
Copy link

Now is December 2020, your code doesn't work.

Somehow, those codes just got us Python 3.5.2, not Python 3.6.

@ahmedlone127
Copy link

so how can we get python 3.6

@maisonhai3
Copy link

I have to build Images FROM ubuntu:18.04.

This way works.

In case you must use 16.04 only, I have no idea.

@ahmedlone127
Copy link

wait what do u mean by this way . i was using centos 7 and everything worked but now i converted to ubuntu and idc about the version i just need jdk8 , python3.6 and pip . could u help me out . i am relaly new to all this and any help would be extremly appreciatedd

@autthapone
Copy link

Does some add-apt-repository ppa:??? latest updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment