How to install pip into a ubuntu container while keeping layers to a minimum? [closed]





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I'm interested in building a small container image which has pip-installed packages, but unfortunately, installing python3-pip via apt-get pulls in a lot of dependencies (348MB) into an otherwise very small minimal ubuntu image (I'm currently using the <50MB ubuntu:xenial images from dockerhub):



root@dce44a07a6a5:/home# apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
Suggested packages:
binutils-doc cpp-doc gcc-7-locales dbus-user-session libpam-systemd pinentry-gnome3 tor debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf
automake libtool flex bison gdb gcc-doc gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
libmpx2-dbg libquadmath0-dbg parcimonie xloadimage scdaemon glibc-doc git bzr gdbm-l10n libstdc++-7-doc make-doc man-browser ed diffutils-doc perl-doc libterm-readline-gnu-perl
| libterm-readline-perl-perl pinentry-doc python-crypto-doc python-cryptography-doc python3-cryptography-vectors python-dbus-doc python3-dbus-dbg gnome-keyring libkf5wallet-bin
gir1.2-gnomekeyring-1.0 python-secretstorage-doc python-setuptools-doc
The following NEW packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
python3-pip python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
0 upgraded, 98 newly installed, 0 to remove and 2 not upgraded.
Need to get 108 MB of archives.
After this operation, 348 MB of additional disk space will be used.


A lot of this is for compilation of c modules. I'm wondering if there is an alternative to using pip for installing python modules when building containers.



Perhaps there is a programmatic way to install pip, install dependencies, and then uninstall pip cleanly in the same docker layer?



i.e. (paraphrasing):



RUN  install_pip && pip install mymod && uninstall_pip









share|improve this question















closed as off-topic by tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden Nov 23 '18 at 12:52


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden

If this question can be reworded to fit the rules in the help center, please edit the question.























    1















    I'm interested in building a small container image which has pip-installed packages, but unfortunately, installing python3-pip via apt-get pulls in a lot of dependencies (348MB) into an otherwise very small minimal ubuntu image (I'm currently using the <50MB ubuntu:xenial images from dockerhub):



    root@dce44a07a6a5:/home# apt-get install python3-pip
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following additional packages will be installed:
    binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
    gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
    libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
    libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
    libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
    python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
    python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
    Suggested packages:
    binutils-doc cpp-doc gcc-7-locales dbus-user-session libpam-systemd pinentry-gnome3 tor debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf
    automake libtool flex bison gdb gcc-doc gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
    libmpx2-dbg libquadmath0-dbg parcimonie xloadimage scdaemon glibc-doc git bzr gdbm-l10n libstdc++-7-doc make-doc man-browser ed diffutils-doc perl-doc libterm-readline-gnu-perl
    | libterm-readline-perl-perl pinentry-doc python-crypto-doc python-cryptography-doc python3-cryptography-vectors python-dbus-doc python3-dbus-dbg gnome-keyring libkf5wallet-bin
    gir1.2-gnomekeyring-1.0 python-secretstorage-doc python-setuptools-doc
    The following NEW packages will be installed:
    binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
    gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
    libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
    libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
    libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
    python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
    python3-pip python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
    0 upgraded, 98 newly installed, 0 to remove and 2 not upgraded.
    Need to get 108 MB of archives.
    After this operation, 348 MB of additional disk space will be used.


    A lot of this is for compilation of c modules. I'm wondering if there is an alternative to using pip for installing python modules when building containers.



    Perhaps there is a programmatic way to install pip, install dependencies, and then uninstall pip cleanly in the same docker layer?



    i.e. (paraphrasing):



    RUN  install_pip && pip install mymod && uninstall_pip









    share|improve this question















    closed as off-topic by tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden Nov 23 '18 at 12:52


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden

    If this question can be reworded to fit the rules in the help center, please edit the question.



















      1












      1








      1








      I'm interested in building a small container image which has pip-installed packages, but unfortunately, installing python3-pip via apt-get pulls in a lot of dependencies (348MB) into an otherwise very small minimal ubuntu image (I'm currently using the <50MB ubuntu:xenial images from dockerhub):



      root@dce44a07a6a5:/home# apt-get install python3-pip
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      The following additional packages will be installed:
      binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
      gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
      libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
      libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
      libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
      python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
      python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
      Suggested packages:
      binutils-doc cpp-doc gcc-7-locales dbus-user-session libpam-systemd pinentry-gnome3 tor debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf
      automake libtool flex bison gdb gcc-doc gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
      libmpx2-dbg libquadmath0-dbg parcimonie xloadimage scdaemon glibc-doc git bzr gdbm-l10n libstdc++-7-doc make-doc man-browser ed diffutils-doc perl-doc libterm-readline-gnu-perl
      | libterm-readline-perl-perl pinentry-doc python-crypto-doc python-cryptography-doc python3-cryptography-vectors python-dbus-doc python3-dbus-dbg gnome-keyring libkf5wallet-bin
      gir1.2-gnomekeyring-1.0 python-secretstorage-doc python-setuptools-doc
      The following NEW packages will be installed:
      binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
      gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
      libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
      libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
      libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
      python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
      python3-pip python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
      0 upgraded, 98 newly installed, 0 to remove and 2 not upgraded.
      Need to get 108 MB of archives.
      After this operation, 348 MB of additional disk space will be used.


      A lot of this is for compilation of c modules. I'm wondering if there is an alternative to using pip for installing python modules when building containers.



      Perhaps there is a programmatic way to install pip, install dependencies, and then uninstall pip cleanly in the same docker layer?



      i.e. (paraphrasing):



      RUN  install_pip && pip install mymod && uninstall_pip









      share|improve this question
















      I'm interested in building a small container image which has pip-installed packages, but unfortunately, installing python3-pip via apt-get pulls in a lot of dependencies (348MB) into an otherwise very small minimal ubuntu image (I'm currently using the <50MB ubuntu:xenial images from dockerhub):



      root@dce44a07a6a5:/home# apt-get install python3-pip
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      The following additional packages will be installed:
      binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
      gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
      libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
      libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
      libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
      python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
      python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
      Suggested packages:
      binutils-doc cpp-doc gcc-7-locales dbus-user-session libpam-systemd pinentry-gnome3 tor debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf
      automake libtool flex bison gdb gcc-doc gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
      libmpx2-dbg libquadmath0-dbg parcimonie xloadimage scdaemon glibc-doc git bzr gdbm-l10n libstdc++-7-doc make-doc man-browser ed diffutils-doc perl-doc libterm-readline-gnu-perl
      | libterm-readline-perl-perl pinentry-doc python-crypto-doc python-cryptography-doc python3-cryptography-vectors python-dbus-doc python3-dbus-dbg gnome-keyring libkf5wallet-bin
      gir1.2-gnomekeyring-1.0 python-secretstorage-doc python-setuptools-doc
      The following NEW packages will be installed:
      binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 dh-python dirmngr dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gir1.2-glib-2.0 gnupg gnupg-l10n
      gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libassuan0 libatomic1 libbinutils
      libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-7-dev libgdbm-compat4 libgdbm5 libgirepository-1.0-1 libglib2.0-0
      libglib2.0-data libgomp1 libicu60 libisl19 libitm1 libksba8 liblocale-gettext-perl liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libperl5.26 libpython3-dev libpython3.6 libpython3.6-dev
      libquadmath0 libstdc++-7-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev netbase patch perl perl-modules-5.26 pinentry-curses python-pip-whl python3-asn1crypto
      python3-cffi-backend python3-crypto python3-cryptography python3-dbus python3-dev python3-distutils python3-gi python3-idna python3-keyring python3-keyrings.alt python3-lib2to3
      python3-pip python3-pkg-resources python3-secretstorage python3-setuptools python3-six python3-wheel python3-xdg python3.6-dev shared-mime-info xdg-user-dirs
      0 upgraded, 98 newly installed, 0 to remove and 2 not upgraded.
      Need to get 108 MB of archives.
      After this operation, 348 MB of additional disk space will be used.


      A lot of this is for compilation of c modules. I'm wondering if there is an alternative to using pip for installing python modules when building containers.



      Perhaps there is a programmatic way to install pip, install dependencies, and then uninstall pip cleanly in the same docker layer?



      i.e. (paraphrasing):



      RUN  install_pip && pip install mymod && uninstall_pip






      python docker ubuntu pip






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 17:26







      init_js

















      asked Nov 23 '18 at 11:31









      init_jsinit_js

      1,106827




      1,106827




      closed as off-topic by tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden Nov 23 '18 at 12:52


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden

      If this question can be reworded to fit the rules in the help center, please edit the question.







      closed as off-topic by tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden Nov 23 '18 at 12:52


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – tripleee, Michael Dodd, Suraj Rao, hoefling, ewolden

      If this question can be reworded to fit the rules in the help center, please edit the question.
























          1 Answer
          1






          active

          oldest

          votes


















          1














          If you have to stick to ubuntu, use apt-get install --no-install-recommends python3-pip. It only takes 33.9 MB, 10 times less. The final imaged is 146M.



          If you are able to use debian, use python:3.6-slim as base image (138M), to push it further, use python:alpine(78.2M).



          You can remove pip with python3 -m pip uninstall pip setuptools for the last 2 cases, but due to the layer overhead, it actually makes it bigger.






          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            If you have to stick to ubuntu, use apt-get install --no-install-recommends python3-pip. It only takes 33.9 MB, 10 times less. The final imaged is 146M.



            If you are able to use debian, use python:3.6-slim as base image (138M), to push it further, use python:alpine(78.2M).



            You can remove pip with python3 -m pip uninstall pip setuptools for the last 2 cases, but due to the layer overhead, it actually makes it bigger.






            share|improve this answer




























              1














              If you have to stick to ubuntu, use apt-get install --no-install-recommends python3-pip. It only takes 33.9 MB, 10 times less. The final imaged is 146M.



              If you are able to use debian, use python:3.6-slim as base image (138M), to push it further, use python:alpine(78.2M).



              You can remove pip with python3 -m pip uninstall pip setuptools for the last 2 cases, but due to the layer overhead, it actually makes it bigger.






              share|improve this answer


























                1












                1








                1







                If you have to stick to ubuntu, use apt-get install --no-install-recommends python3-pip. It only takes 33.9 MB, 10 times less. The final imaged is 146M.



                If you are able to use debian, use python:3.6-slim as base image (138M), to push it further, use python:alpine(78.2M).



                You can remove pip with python3 -m pip uninstall pip setuptools for the last 2 cases, but due to the layer overhead, it actually makes it bigger.






                share|improve this answer













                If you have to stick to ubuntu, use apt-get install --no-install-recommends python3-pip. It only takes 33.9 MB, 10 times less. The final imaged is 146M.



                If you are able to use debian, use python:3.6-slim as base image (138M), to push it further, use python:alpine(78.2M).



                You can remove pip with python3 -m pip uninstall pip setuptools for the last 2 cases, but due to the layer overhead, it actually makes it bigger.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 '18 at 12:38









                SiyuSiyu

                3,25211231




                3,25211231

















                    Popular posts from this blog

                    "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                    Alcedinidae

                    Origin of the phrase “under your belt”?