forked from silvio/docker-borgbackup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.md.html
44 lines (41 loc) · 4.31 KB
/
readme.md.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<p>This docker project brings the small and simple backup solution <a href="https://borgbackup.github.io/">borg</a> to your computer.</p>
<h1 id="how-to-use">How to use</h1>
<h2 id="test-this-image">test this image</h2>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">docker</span> run -ti docker-borgbackup -h
<span class="kw">usage</span>: borg [-h]
<span class="dt">{serve,init,check,change-passphrase,create,extract,rename,delete,list,mount,info,prune,help}</span>
<span class="kw">...</span>
<span class="kw">Borg</span> 0.24.0+17.g3100fac - Deduplicated Backups
<span class="kw">optional</span> arguments:
<span class="kw">-h</span>, --help show this help message and exit
<span class="kw">Available</span> commands:
<span class="dt">{serve,init,check,change-passphrase,create,extract,rename,delete,list,mount,info,prune,help}</span></code></pre></div>
<p>Maybe its better to put <code>docker run -ti docker-borgbackup</code> in an <code>borg</code>-alias or script for the shell.</p>
<h1 id="automatic-backup">Automatic backup</h1>
<p>This Dockerfile is arranged to do automatic backups. For this the option <code>mybackup</code> is added.</p>
<h2 id="concept">concept</h2>
<p>We run borg in a container which needs access to the directories/files which need a backup and the directory in which we put the backup, furthermore we need a configuration file for automation of the backup process via a cron job. For this we use docker specific options.</p>
<p>All folders or files and the configuration file for the backup have to be mounted in the <code>/B</code> folder.</p>
<p>The store folder for the backup have to be in <code>/backupdir</code>.</p>
<h2 id="ini-parameter"><code>ini</code>-parameter</h2>
<p>The file must be named <code>borg-backup.ini</code>. The file must have <code>MISC</code> and <code>REPO</code> and could have <code>PRUNE</code> and <code>EXCLUDE</code> sections.</p>
<p>In this repository we have a <code>ini</code>-file example.</p>
<h3 id="misc">MISC</h3>
<p>Two options exists in the <code>MISC</code> section. One is <code>version</code> and has to be the same as the in-docker <code>mybackup</code> script. And the second option is for <code>verbose</code> output.</p>
<h3 id="repo">REPO</h3>
<p>You mount your backup folder into the <code>backupdir</code> folder of the docker image. Your backup repositories are accessible through the <code>backuprepo</code> option. And the backup archives are generated from the <code>backupname</code>, <code>dateappend</code> and <code>dateformat</code> options.</p>
<h3 id="prune">PRUNE</h3>
<p>You can disable pruning via <code>enable</code> option. The <code>borg</code> options for <code>--keep-hourly</code>, <code>--keep-daily</code>, <code>--keep-weekly</code>, <code>--keep-monthly</code> and <code>--keep-yearly</code> have a corresponding option via the <code>ini</code>-file options <code>hourly</code>, <code>daily</code>, <code>weekly</code>, <code>monthly</code> and <code>yearly</code>.</p>
<h3 id="exclude">EXCLUDE</h3>
<p>All entries in the <code>EXCLUDE</code> section are added to the <code>--exclude</code> option at archive creation time. The name of the <code>ini</code>-file entries are regardless.</p>
<h2 id="example">example</h2>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">docker</span> run -ti -v /etc:/B/etc -v ~/borg-backup.ini:/B/borg-backup.ini -v /mnt/ext/BACKUP:/backupdir docker-borgbackup init /backupdir
$ <span class="kw">docker</span> run -ti -v /etc:/B/etc -v ~/borg-backup.ini:/B/borg-backup.ini -v /mnt/ext/BACKUP:/backupdir docker-borgbackup create /backupdir::xxx /B/...</code></pre></div>
<h2 id="automation">Automation</h2>
<p>You have to setup a cronjob with <code>mybackup</code> as command, the <code>borg-backup.ini</code> file and start the service with <code>mybackup</code> as command.</p>
<h2 id="example-1">example</h2>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">crontab</span> -l
<span class="kw">0</span> * * * * docker run -v /etc:/B/etc \
-v /development:/B/development \
-v <span class="ot">$HOME</span>/ab.ini:/B/borg-backup.ini \
--privileged silviof/docker-borgbackup mybackup</code></pre></div>