Skip to content

Docker image for the official Backblaze B2 command line tool

License

Notifications You must be signed in to change notification settings

kimmobrunfeldt/docker-backblaze-b2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Backblaze B2 command line tool image

kimmobrunfeldt/backblaze-b2

Docker image for the official Backblaze B2 command line tool (Backblaze/B2_Command_Line_Tool)

Supported tags and respective Dockerfile links

How to use it

Authorization is done before the command you give is ran.

docker run --rm -v $PWD:/root -e B2_ACCOUNT_ID=$B2_ACCOUNT_ID -e B2_APPLICATION_KEY=$B2_APPLICATION_KEY kimmobrunfeldt/backblaze-b2 b2 list-buckets

will underneath run:

b2 authorize_account your-account-id your-application-key
b2 list-buckets

The options explained:

  • --rm Automatically remove the container when it exits
  • -v $PWD:/root Map current working directory to /root inside the docker container. Allows reading and writing files between container and host.
  • -e Pass environment variable inside the container.

You can see all the available b2 commands by running:

docker run --rm kimmobrunfeldt/backblaze-b2 b2 --help

Using B2 for backups

Before using this method you need to take GPG into use: https://www.liquidweb.com/kb/how-do-i-use-gpg/.

I recommend creating an encrypted file containing the environment variables, so that you can easily backup and restore files later.

Create b2-env.sh file with the contents:

export B2_ACCOUNT_ID=your-account-or-application-id
export B2_APPLICATION_KEY=your-application-key

Now encrypt the file with gpg: gpg -c b2-env.sh and remove the plain text one permanently from disk.

Restore file

You can optionally encrypt your files with GPG before uploading them to B2.

source <(gpg --decrypt b2-env.sh.gpg)

docker run --rm -v $PWD:/root -e B2_ACCOUNT_ID=$B2_ACCOUNT_ID -e B2_APPLICATION_KEY=$B2_APPLICATION_KEY kimmobrunfeldt/backblaze-b2 b2 download_file_by_name MY_BUCKET file-name-in-bucket.tar.gz ./my-file-locally.tar.gz

Backup file

source <(gpg --decrypt b2-env.sh.gpg)

docker run --rm -v $PWD:/root -e B2_ACCOUNT_ID=$B2_ACCOUNT_ID -e B2_APPLICATION_KEY=$B2_APPLICATION_KEY kimmobrunfeldt/backblaze-b2 b2 upload-file MY_BUCKET ./my-file-locally.tar.gz file-name-in-bucket.tar.gz

Build and update process

This image is automatically built at every push of this repository.

About

Docker image for the official Backblaze B2 command line tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 74.4%
  • Dockerfile 19.6%
  • Shell 6.0%