Reputation: 963
I am writing Dockerfile in which trying to download file from s3 to local using aws cli and ADD those files to docker container as below following this page
FROM nrel/energyplus:8.9.0
RUN apt-get update && \
apt-get install -y \
python3 \
python3-pip \
python3-setuptools \
groff \
less \
&& pip3 install --upgrade pip \
&& apt-get clean
RUN pip3 --no-cache-dir install --upgrade awscli
ADD . /var/simdata
WORKDIR /var/simdata
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ARG AWS_REGION=ap-northeast-1
RUN aws s3 cp s3://file/to/path .
RUN mkdir -p /var/simdata
ENTRYPOINT [ "/bin/bash" ]
After running docker build -it <container id>
, I expected that I can find the file downloaded from s3 in container, but I could not.
Does anyone know where I can find this file downloaded from s3?
Upvotes: 1
Views: 4485
Reputation: 5536
A better approach would be download the file to your local from s3 and in Dockerfile copy that file to /var/simdata
COPY file /var/simdata/file
This will give you more control.
Upvotes: 1
Reputation: 1988
The file should be in /var/simdata.
Since you do not change your work dir before downloading the file from s3, your image uses nrel/energyplus:8.9.0 default work dir.
$ docker pull nrel/energyplus:8.9.0
$ docker inspect --format '{{.ContainerConfig.WorkingDir}}' nrel/energyplus:8.9.0
/var/simdata
Upvotes: 1