Dropbox in Docker

2018/03/16

I am inspired by this blog post about running applications through Docker to prevent programs from leaving remnants all over my OS.

The first thing to try out is Dropbox. Luckily there are already Docker images available with Dropbox and I am going for a small image based on Alpine: https://github.com/dylansm/dropbox

When trying Dropbox images I learned that if they are too old (say, more than 6 months) the image may work and the Dropbox daemon starts, but after authenticating to your Dropbox account no files are downloaded. The fix is to build the image yourself (without altering the Dockerfile) to get the latest Dropbox installation.

After building the image (in the folder with the Dockerfile) with

docker build -t dropbox .
a container with my setup is created with the following command:
docker create --restart=always --name dropbox \
	-v /home/robert/Dropbox:/home/user/Dropbox \
	-v /home/robert/.dropbox:/home/user/.dropbox \
	-p 17500:17500 dropbox

The container is started with docker start dropbox. As explained in the repository’s README there are a few steps to link to your Dropbox account after the first start. Here I recap only a minimum – check the README for more details.

First you need a link for authentication:

docker logs dropbox
Follow the link and enter your credentials. Soon after the command above will inform you that the computer is linked to Dropbox.

Dropbox’s cli tool can be run inside the container, for instance to see the status of Dropbox:

docker exec -it $(docker ps -f name=dropbox -q | awk 'NR==1{print $1}') dropbox-cli status
The cli is documented on the Dropbox Wiki