Reputation: 2055
In my alpine based docker image, I have installed boto3.output of dockerbuild from docker-compose.
Running setup.py install for s3cmd: started
Running setup.py install for s3cmd: finished with status 'done'
Successfully installed awscli-1.14.5 **boto3-1.13.15** botocore-1.8.9 colorama-0.3.7 docutils-0.16 futures-3.3.0 jmespath-0.10.0 pyasn1-0.4.8 python-dateutil-2.8.1 pyyaml-5.3.1 rsa-3.4.2 s3cmd-2.0.1 s3transfer-0.1.13 six-1.15.0
snippet of dockerfile looks like below,
FROM alpine:3.6
RUN apk -v --update add \
python3 \
py-pip \
groff \
less \
mailcap \
curl \
jq && \
pip install --upgrade pip && \
pip install --no-cache-dir awscli==1.14.5 s3cmd==2.0.1 boto3 pyyaml && \
apk -v --purge del py-pip && \
rm /var/cache/apk/*
when I try to execute my python package via docker-compose using same Dockerfile: its says
setup-application_1 | File "test_cf_create_or_update.py", line 1, in <module>
setup-application_1 | import boto3
setup-application_1 | ModuleNotFoundError: No module named 'boto3'
localstack_setup-application_1 exited with code 1
I don't know, how to resolve this.
Upvotes: 1
Views: 1821
Reputation: 374
Try:
pip3 install boto3 -t .
It seems that boto is not going to the right target, with "t" flag and ".", you make sure it is seen by all!
Upvotes: 2
Reputation: 238051
Since you are installing python3
, you should be using pip3
:
pip3 install --upgrade pip && \
pip3 install --no-cache-dir awscli==1.14.5 s3cmd==2.0.1 boto3 pyyaml && \
And the in the container you will use python3
to execute your script.
Also worth noting is the fact that since you have fixed the versions of awscli
and s3cmd
, you will be getting warnings about either too old or too new libraries when building the docker image.
Upvotes: 1