GithubHelp home page GithubHelp logo

istepanov / docker-backup-to-s3 Goto Github PK

View Code? Open in Web Editor NEW
134.0 8.0 105.0 14 KB

Docker container that periodically backups files to Amazon S3 using s3cmd and cron

Home Page: https://hub.docker.com/r/istepanov/backup-to-s3/

License: MIT License

Shell 75.93% Dockerfile 24.07%
cron s3cmd backup s3-bucket docker

docker-backup-to-s3's Introduction

istepanov/backup-to-s3

Docker Stars Docker Pulls Docker Build Layers

Docker container that periodically backups files to Amazon S3 using s3cmd sync and cron.

Usage

docker run -d [OPTIONS] istepanov/backup-to-s3

Parameters:

  • -e ACCESS_KEY=<AWS_KEY>: Your AWS key.
  • -e SECRET_KEY=<AWS_SECRET>: Your AWS secret.
  • -e S3_PATH=s3://<BUCKET_NAME>/<PATH>/: S3 Bucket name and path. Should end with trailing slash.
  • -v /path/to/backup:/data:ro: mount target local folder to container's data folder. Content of this folder will be synced with S3 bucket.

Optional parameters:

  • -e PARAMS="--dry-run": parameters to pass to the sync command (full list here).
  • -e DATA_PATH=/data/: container's data folder. Default is /data/. Should end with trailing slash.
  • -e 'CRON_SCHEDULE=0 1 * * *': specifies when cron job starts (details). Default is 0 1 * * * (runs every day at 1:00 am).
  • no-cron: run container once and exit (no cron scheduling).

Examples:

Run upload to S3 everyday at 12:00pm:

docker run -d \
    -e ACCESS_KEY=myawskey \
    -e SECRET_KEY=myawssecret \
    -e S3_PATH=s3://my-bucket/backup/ \
    -e 'CRON_SCHEDULE=0 12 * * *' \
    -v /home/user/data:/data:ro \
    istepanov/backup-to-s3

Run once then delete the container:

docker run --rm \
    -e ACCESS_KEY=myawskey \
    -e SECRET_KEY=myawssecret \
    -e S3_PATH=s3://my-bucket/backup/ \
    -v /home/user/data:/data:ro \
    istepanov/backup-to-s3 no-cron

Run once to get from S3 then delete the container:

docker run --rm \
    -e ACCESS_KEY=myawskey \
    -e SECRET_KEY=myawssecret \
    -e S3_PATH=s3://my-bucket/backup/ \
    -v /home/user/data:/data:rw \
    istepanov/backup-to-s3 get

Run once to delete from s3 then delete the container:

docker run --rm \
    -e ACCESS_KEY=myawskey \
    -e SECRET_KEY=myawssecret \
    -e S3_PATH=s3://my-bucket/backup/ \
    istepanov/backup-to-s3 delete

Security considerations: on restore, this opens up permissions on the restored files widely.

docker-backup-to-s3's People

Contributors

istepanov avatar pve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-backup-to-s3's Issues

Outdated s3cmd

Hi istepanov,

I ran into issues with filenames with special characters in and realised that apt-get is using version 1.1 of s3cmd, the current stable version is 1.5.2.

I have forked your project here that uses the github zip file instead of apt-get to install s3cmd.
https://github.com/robbydooo/docker-backup-to-s3

Not sure if you would like these changes or not but if you do I can submit a pull request and then remove my forked copy.

Let me know.

Thanks,
Rob

Could this work with Raspberry Pi?

Hello!

I was wondering if this docker could be updated or atleast set to work with raspberry pi.

I have already tried a few arm32v7 base images but haven't gotten it to work. It's always broken in the build of the image.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.