Run a random user by default and add rsync support and example.

This commit is contained in:
Werner Beroux
2016-01-23 02:18:13 +01:00
parent 65be5edd0d
commit fa4f399740
2 changed files with 19 additions and 3 deletions

View File

@@ -1,14 +1,17 @@
FROM alpine:3.3 FROM alpine:3.3
RUN apk add --update duplicity openssl py-crypto py-pip \ RUN apk add --update duplicity openssh openssl py-crypto py-pip rsync \
&& pip install pydrive==1.0.1 \ && pip install pydrive==1.0.1 \
&& apk del --purge py-pip \ && apk del --purge py-pip \
&& rm /var/cache/apk/* \ && rm /var/cache/apk/* \
&& adduser -D -u 1896 duplicity \
&& mkdir -p /home/duplicity/.cache/duplicity \ && mkdir -p /home/duplicity/.cache/duplicity \
&& chmod go+rwx /home/duplicity/.cache/duplicity && chmod go+rwx /home/duplicity/.cache/duplicity
ENV HOME=/home/duplicity ENV HOME=/home/duplicity
VOLUME /home/duplicity/.cache/duplicity VOLUME /home/duplicity/.cache/duplicity
USER duplicity
CMD ["duplicity"] CMD ["duplicity"]

View File

@@ -6,7 +6,7 @@ Features of this Docker image:
* **Small**: Built using [alpine](https://hub.docker.com/_/alpine/). * **Small**: Built using [alpine](https://hub.docker.com/_/alpine/).
* **Simple**: Most common cases are explained below and require minimal setup. * **Simple**: Most common cases are explained below and require minimal setup.
* **Secure**: Runs as any user (so pic any random UID or run as your user which avoids to run as `root` which isn't the safest). * **Secure**: Runs non-root by default (use randomly chosen UID `1896`), and meant to run as any user.
## Usage ## Usage
@@ -77,7 +77,20 @@ To **restore**, you'll need:
### Backup via rsync example ### Backup via rsync example
**TODO** Supposing you've an **SSH** access to some machine, you can:
$ docker run --rm -it --user root \
-e PASSPHRASE=P4ssw0rd \
-v /:/data:ro \
-v ~/.ssh/id_rsa:/id_rsa:ro \
-v ~/.ssh/known_hosts:/etc/ssh/ssh_known_hosts:ro \
wernight/duplicity \
duplicity --rsync-options='-e "ssh -i /id_rsa"' /data rsync://user@example.com/some_dir
Note: We're running here as `root` to have access to `~/.ssh` and also because ssh does not
allow to use a random (non-locally existing) UID. To make it safer, you can copy your `~/.ssh`
and `chown 1896` it (that is `duplicity` UID within the container). If you know a another way to avoid
the "No user exists for uid" check, please let me know.
### More help ### More help