I am very new to docker. I am building a docker for the first time. I have created a Dockerfile and need to add python packages (specifically to emails). However I am getting an error while building the docker file.
FROM alpine MAINTAINER <[email protected]> FROM python:3.7 RUN pip install --upgrade pip && \ pip install --no-cache-dir nibabel pydicom matplotlib pillow && \ pip install --no-cache-dir med2image RUN pip install pandas xlsxwriter numpy boto boto3 botocore RUN pip install oauth2client urllib3 httplib2 email mimetypes apiclient RUN pip install snowflake.connector ENV APP_HOME /Users/username/ ENV TZ=America/Los_Angeles RUN mkdir -p $APP_HOME/code/ WORKDIR $APP_HOME ENTRYPOINT [ "python"] I am getting the following error:
Downloading https://files.pythonhosted.org/packages/71/e7/816030d3b0426c130040bd068be62b9213357ed02896f5d9badcf46d1b5f/email-4.0.2.tar.gz (1.2MB) Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 18, in <module> import setuptools.version File "/usr/local/lib/python3.7/site-packages/setuptools/version.py", line 1, in <module> import pkg_resources File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 36, in <module> import email.parser File "/tmp/pip-install-1m3cdjov/email/email/parser.py", line 10, in <module> from cStringIO import StringIO ModuleNotFoundError: No module named 'cStringIO' ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-1m3cdjov/email/ The command '/bin/sh -c pip install oauth2client urllib3 httplib2 email mimetypes apiclient' returned a non-zero code: 1 I have installed these packages successfully in Pycharm and have no issues with it. I am not sure how to fix this in docker. Any help would be appreciated.
docker exec -ti my_container bashthen installing withpip install. After that I'd runpip freeze > requirements.txtthen install all the packages from that in the Dockerfile for all subsequent builds.