1
2
3
4
5
6
7
8
9
| FROM debian:11
RUN apt update && apt install -y unzip curl
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
#RUN apt install -y wget gnupg
#RUN wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | apt-key add -
#RUN wget -O /etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list
#RUN apt update && apt install s3cmd
CMD bash
|
Then build with
1
| docker build . -f Dockerfile.awscli -t awscli
|
Now run it, passing in the right environment variables:
1
2
3
4
5
6
| docker run --rm -it \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
-e AWS_END_POINT \
-e BUCKET_NAME \
awscli
|
Then to list the buckets:
1
| aws s3 ls --endpoint=${AWS_END_POINT}
|
And to copy a file over:
1
| aws s3 cp testfile s3://${BUCKET_NAME}/testfile --acl public-read --endpoint=${AWS_END_POINT}
|