This container zips, encrypts, and uploads /data
to Amazon S3.
By default, it calls run.sh when the container starts.
Before running the container, you'll need to setup a GPG public key, an AWS user, and an S3 bucket.
docker run --restart=always -d --name=backup \
-e "PUID=1000" \
-e "PGID=1000" \
-v $(pwd):/data:ro \
-v /path_to_recipient/recipient.asc:/recipient/recipient.asc:ro \
-v ~/.aws:/config/.aws:ro \
-e BUCKET_NAME=your-bucket-name \
jaynewstrom/aws-s3-gpg-backup
- Bucket name may include a folder to nest within.
jaynewstrom-backup/home
- Customize the filename with the following environment variables:
FILENAME_PREFIX
DATE
- Customize the GPG public key to read from with the
RECIPIENT_FILENAME
environment variable - Customize the
aws s3 cp
options via theAWS_OPTIONS
environment variable - Skip the initial run via the environment variable
SKIP_INITIAL_RUN=true
- Configure compression type via
COMPRESSION_TYPE
:zip
- defaulttar.gz
- Run via cron by adding an environment variable
CRON=15 8 * * *
- Run the cron as an alternate user via
CRON_USER=root
- Backup multiple files/folders by mounting multiple volumes into the data directory
-
docker run --restart=always -d --name=backup \ -e "PUID=1000" \ -e "PGID=1000" \ -v $(pwd)/one:/data/one:ro \ -v $(pwd)/two:/data/two:ro \ -v $(pwd)/three:/data/three:ro \ -v /path_to_recipient/recipient.asc:/recipient/recipient.asc:ro \ -v ~/.aws:/config/.aws:ro \ -e BUCKET_NAME=your-bucket-name \ jaynewstrom/aws-s3-gpg-backup
-
In order to restore, first mount the private key into the container. The files will be restored into the restore volume.
docker run --rm -it --name=restore \
-e "PUID=1000" \
-e "PGID=1000" \
-v $(pwd):/restore \
-v ~/.aws:/config/.aws:ro \
--entrypoint "/app/restore.sh" \
-e BUCKET_NAME=your-bucket-name \
jaynewstrom/aws-s3-gpg-backup file-to-restore.zip.gpg
- Build for the current architecture only:
docker build -t jaynewstrom/aws-s3-gpg-backup .
- Build for multiple architectures:
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t jaynewstrom/aws-s3-gpg-backup . --push
Copyright 2020 Jay Newstrom
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.