Dropbox in docker

June 28, 2015 at 16:38

I was thinking of an easy way to backup the wp-content directory of my two blogs (the other one being Una Cerveza Al Día 😀 ) and Dropbox came to my mind: my space requirements are very modest, even for the beer blog with its one-picture-per-entry basis (after 4 years is using around 500MB).

Since I very recently moved everything from puppet to docker, I thought Dropbox should be no less that the rest of the services (these being right now mysql, apache2, nginx and varnish 🙂 ).

There were some Dockerfiles available for doing this, but it was quite simple so I gave it a go myself. You can find the repository in my Github account, under the name docker-dropbox.

The README describes how to run the container, and is pretty straightforward. The only gotcha is that Dropbox requires you to authorize new devices, and dropboxd (the daemon included in the Dropbox Headless packages) does this step by printing a link in the standard output the first time it’s launched. Once the link is opened in a browser and the docker container is added to the allowed devices, this is stored in the config directory.

This has 2 consequences for the container:

  1. The first time the container is deployed you need to run docker logs deigote.com-dropbox to be able to grab the authorization link.
  2. The config file where the authorization is stored needs to be kept. For my, the easiest way to do this is to mount the whole config from the host filesystem, thus keeping the whole configuration persistent regardless of docker.

Other than that, it worsk great: my pictures, plugins and themes are always backed up, making it very easy to switch to a new host – as I did very recently 🙂 .