To build the image:
$ docker build \
> --file get-pip.Dockerfile \
> --tag dhermes/repro-4352:latest \
> .
After building and running the shell, the import succeeds:
$ docker run \
> --rm \
> --tty \
> --interactive \
> dhermes/repro-4352:latest \
> /bin/bash
root@4fddb8425b8e:/projects# python
Python 2.7.6 (default, Nov 7 2017, 06:37:46)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import google.protobuf
>>> google.protobuf
<module 'google.protobuf' from '/usr/local/lib/python2.7/site-packages/google/protobuf/__init__.pyc'>
root@3ff8fc23f38f:/projects#
root@3ff8fc23f38f:/projects#
root@3ff8fc23f38f:/projects#
root@3ff8fc23f38f:/projects# pip freeze
cachetools==2.0.1
certifi==2017.11.5
chardet==3.0.4
google-api-python-client==1.4.2
google-apitools==0.4.11
google-auth==1.2.0
google-auth-httplib2==0.0.2
google-cloud-core==0.24.1
google-cloud-storage==1.1.1
google-resumable-media==0.0.2
googleapis-common-protos==1.5.3
httplib2==0.10.3
idna==2.6
oauth2client==4.1.2
protobuf==3.4.0
protorpc==0.12.0
pyasn1==0.3.7
pyasn1-modules==0.1.5
requests==2.18.4
rsa==3.4.2
six==1.11.0
uritemplate==3.0.0
urllib3==1.22
To build the other image, which uses requirements.txt
and
installs pip
via apt-get
:
$ docker build \
> --file apt-get.Dockerfile \
> --tag zafields/repro-4352:latest \
> .
After building, running:
$ docker run \
> --rm \
> --tty \
> --interactive \
> zafields/repro-4352:latest \
> /bin/bash