Giter Club home page Giter Club logo

docker-dropbox's Introduction

๐Ÿณ Dropbox Docker Image

This repository provides the otherguy/dropbox image

Docker Pulls Docker Stars GitHub issues Travis MicroBadger Layers GitHub stars MIT License

Run Dropbox inside a Docker container. Supports local host folder mount or inter-container linking via --volumes-from.

๐Ÿšจ Warning for macOS Users

For macOS users, mounting the Dropbox data folder is currently not possible! See #6 for details

Back in 2018, Dropbox dropped support for several Linux filesystems and the Dropbox client refused to sync when an unsupported filesystem was encountered.

In July 2019, the decision was partially rolled back, allowing syncing from ZFS (on 64-bit systems only), eCryptFS, XFS (on 64-bit systems only), and BTRFS filesystems. Other filesystems dropped by the initial change are, however, still unsupported.

A dropbox-filesystem-fix patch was developed by @dark and was previously used in this Docker image to make it work with Docker volume mounts, especially on macOS where the mounted volume uses the FUSE filesystem.

Unfortunately, as of January 2020 (Dropbox version 87.4.138 and later, currently up to 95.4.441 115.4.601), this fix is unable to get around the filesystem detection in the newer Dropbox client versions. Using an older version of the Dropbox client is also not possible, because the Dropbox API servers reject old client version and prevent them from connecting.

This breaks the possibility to mount a local folder via -v "/path/to/local/dropbox:/opt/dropbox/Dropbox" on macOS systems.

๐Ÿš€ Usage

Quickstart

This is the full command to start the Dropbox container. All volumes, environment variables and parameters are explained in the sections below.

$ docker run --detach -it --restart=always --name=dropbox \
  --net="host" \
  -e "TZ=$(readlink /etc/localtime | sed 's#^.*/zoneinfo/##')" \
  -e "DROPBOX_UID=$(id -u)" \
  -e "DROPBOX_GID=$(id -g)" \
  -e "POLLING_INTERVAL=20" \
  -v "/path/to/local/settings:/opt/dropbox/.dropbox" \
  -v "/path/to/local/dropbox:/opt/dropbox/Dropbox" \
  otherguy/dropbox:latest

Checking Dropbox Version

Dropbox will return incorrect information (Dropbox daemon version: Not installed) when you run dropbox version in the container. In case you ever need to know which version you have installed, instead run the following:

$ docker exec -it dropbox cat /opt/dropbox/bin/VERSION

Persisting Data

When mounting the Dropbox data folder to your local filesystem, you need to set the DROPBOX_UID and DROPBOX_GID environment variables to the user id and group id of whoever owns these files on the host or in the other container. Failing to do so causes file permission errrors.

The example below uses id -u and id -g to retrieve the current user's user id and group id, respectively.

$ docker run --name=dropbox \
  -e "DROPBOX_UID=$(id -u)" \
  -e "DROPBOX_GID=$(id -g)" \
  -v "/path/to/local/settings:/opt/dropbox/.dropbox" \
  -v "/path/to/local/dropbox:/opt/dropbox/Dropbox" \
  [...]
  otherguy/dropbox:latest

Time Zones

It is also highly recommended to pass your local timezone settings into the container. This fixes the problem of the host being on local time zone and container defaulting to UTC timezone. Dropbox is not checking time zones when comparing file timestamps, leading to overwritten files and data loss.

You can pass your local timezone as an environment variable to the container: -e "TZ=Australia/Brisbane"

If you're on Linux ๐Ÿง, you can mount your /etc/timezone and /etc/localtime files into the container instead.

$ docker run --name=dropbox \
  -v "/etc/timezone:/etc/timezone" \
  -v "/etc/localtime:/etc/localtime" \
  [...]
  otherguy/dropbox:latest

If you are on macOS or Linux, getting your current timezone and passing it into the container as an environment variable, is the simplest way.

$ docker run --name=dropbox \
  -e "TZ=$(readlink /etc/localtime | sed 's#^.*/zoneinfo/##')" \
  [...]
  otherguy/dropbox:latest

Enable LAN Sync

Using --net="host" allows Dropbox to utilize [local LAN sync] (https://help.dropbox.com/installs-integrations/sync-uploads/lan-sync-overview).

$ docker run --name=dropbox \
  --net="host" \
  [...]
  otherguy/dropbox:latest

Linking Dropbox Account

To link Dropbox to your account, check the logs of the Docker container to retrieve the Dropbox authentication URL:

$ docker logs --follow dropbox

Dropbox Account Linking

Copy and paste the URL in a browser and login to your Dropbox account to associate the Docker container. You should see something like this:

This computer is now linked to Dropbox. Welcome [your name]"

Manage Dropbox Settings

To manage Dropbox exclusions or get a sharing link, you need to execute the dropbox command inside the Docker Dropbox container:

$ docker exec -it dropbox gosu dropbox dropbox [dropbox command]

For example, to get an overview of the commands possible, use help:

$ docker exec -it dropbox gosu dropbox dropbox help

Or to see the current sync status use status:

$ docker exec -it dropbox gosu dropbox dropbox status

Configuration

Environment Variables

  • DROPBOX_UID If set, runs Dropbox with a custom user id. This must match the user id of the owner of the mounted files. Defaults to 1000.

  • DROPBOX_GID If set, runs Dropbox with a custom user id. This must match the group id of the owner of the mounted files. Defaults to 1000.

  • DROPBOX_SKIP_UPDATE If set to true, skips updating the Dropbox app on container startup. Note: This is not very reliable because the Dropbox daemon will still try to update itself even if this is set to true.

  • POLLING_INTERVAL Needs to be set to a positive integer value. The Dropbox daemon is polled for its status at regular intervals, which can be configured to reduce load on the system. This is the number in seconds to wait between polling the Dropbox daemon. Defaults to 5.

Exposed Volumes

  • /opt/dropbox/Dropbox The actual Dropbox folder, containing all your synced files.

  • /opt/dropbox/.dropbox Account and other settings for Dropbox. If you don't mount this folder, your account needs to be linked every time you restart the container.

๐Ÿšง Contributing

Bug reports and pull requests are welcome on GitHub at otherguy/docker-dropbox.

โ™ฅ๏ธ Acknowledgements

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.