Skip to content

sourcifyeth/s3cmd-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 

Repository files navigation

s3cmd-docker

Credits

This repo is based on sekka1/docker-s3cmd, but we modified the way it works quite heavily.

Badges

GitHub forks GitHub stars GitHub issues Twitter Docker Pulls Docker Stars

What is this?

s3cmd in a Docker container. This is useful if you are already using Docker. You can simply pull this container to that Docker server and move things between the local box and S3 by just running a container.

Using Alpine linux. This image is ~15MB.

You can find an automated build of this container on the Docker Hub: hochzehn/s3cmd

How to use

Copy from local to S3:

AWS_KEY=<YOUR AWS KEY>
AWS_SECRET=<YOUR AWS SECRET>
BUCKET=s3://your-bucket-name/
LOCAL_FILE=/tmp/database

docker run --rm \
  --env aws_key=${AWS_KEY} \
  --env aws_secret=${AWS_SECRET} \
  --env cmd=sync-local-to-s3 \
  --env DEST_S3=${BUCKET}  \
  -v ${LOCAL_FILE}:/opt/src \
  hochzehn/s3cmd
  • Change LOCAL_FILE to file/folder you want to upload to S3
  • Append any options to pass to s3cmd at the end, e.g. --delete-removed: ... hochzehn/s3cmd --delete-removed

Copy from S3 to local:

AWS_KEY=<YOUR AWS KEY>
AWS_SECRET=<YOUR AWS SECRET>
BUCKET=s3://your-bucket-name/
LOCAL_FILE=/tmp

docker run --rm \
  --env aws_key=${AWS_KEY} \
  --env aws_secret=${AWS_SECRET} \
  --env cmd=sync-s3-to-local \
  --env SRC_S3=${BUCKET} \
  -v ${LOCAL_FILE}:/opt/dest \
  hochzehn/s3cmd
  • Change LOCAL_FILE to the file/folder to download the files from S3 to
  • Append any options to pass to s3cmd at the end, e.g. --delete-removed: ... hochzehn/s3cmd --delete-removed

Run any s3cmd command

AWS_KEY=<YOUR AWS KEY>
AWS_SECRET=<YOUR AWS SECRET>

docker run -rm \
  --env aws_key=${AWS_KEY} \
  --env aws_secret=${AWS_SECRET} \
  hochzehn/s3cmd \
  ls /

About

s3cmd in a Docker container

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 75.7%
  • Dockerfile 24.3%