Deployment guide

Running CloudDrive2 in Docker

The image is cloudnas/clouddrive2. For mounts made inside the container to be visible on the host, the host's mount propagation has to be shared — which many systems already are, so check before you change anything. This page covers the check, the fix when one is needed, and a configuration you can copy as it stands.

Image

Supported architectures

Three architectures under the same image name. Pick the tag that matches the host CPU.

Architectures supported by the CloudDrive2 Docker image and their tags
ArchitectureTag
x86-64amd64
arm64arm64
armv7arm32
If the image will not update

When Docker refuses to pull the newest version of the image, try disabling your Docker registry mirror and pulling from the official source directly.

Before you run it

Check whether shared mounts are already on

For mounts inside the container to be visible on the host, the host directory's mount propagation has to be shared. Plenty of systems ship that way already, so check before changing anything.

CloudDrive uses fuse3 to mount cloud storage, and that propagation setting is what lets a fuse3 mount point be shared between the container and the host. Without it, mounting inside the container fails outright with a permission denied error.

Check first

Replace the path with the directory you intend to give the container:

findmnt -o TARGET,PROPAGATION /path/to/dir

If the PROPAGATION column reads shared, it is already on and you can skip this whole section and go straight to the configuration below. On a minimal system without findmnt, read /proc instead — a shared: in the output means it is on:

grep ' / ' /proc/self/mountinfo
Systems that already have it on

As far as we know, LibreELEC, CoreELEC and fnOS need none of this. Check to confirm, then leave them alone.

Turning it on if it is off

Two options — pick the one that matches how Docker runs on your host.

Option 1 · Docker runs as a systemd service

Enable MountFlags in the Docker service:

sudo mkdir -p /etc/systemd/system/docker.service.d/
sudo cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf
[Service]
MountFlags=shared
EOF
sudo systemctl restart docker.service

Option 2 · Docker does not run as a systemd service

Enable the shared mount option on the host directly. Replace /path/to/dir with the directory you intend to give the container — the same one you checked above. df finds the mount point it sits on, and mount --make-shared marks that mount point shared:

sudo mount --make-shared $(df -P /path/to/dir | tail -1 | awk '{ print $6 }')
Option 2 does not survive a reboot

mount --make-shared only applies to the running system and has to be repeated after a restart. If you want CloudDrive to come back up automatically, add the command to your system's startup items.

Usage

Starting the container

The Compose and CLI forms are equivalent. Use whichever you prefer.

Docker Compose

version: "2.1"
services:
  cloudnas:
    image: cloudnas/clouddrive2
    container_name: clouddrive2
    environment:
      - TZ=Asia/Shanghai
      - CLOUDDRIVE_HOME=/Config
    volumes:
      - <path to accept cloud mounts>:/CloudNAS:shared
      - <path to app data>:/Config
      - <other local shared path>:/media:shared #optional media path of host
    devices:
      - /dev/fuse:/dev/fuse
    restart: unless-stopped
    pid: "host"
    privileged: true
    network_mode: "host"

Docker CLI

docker run -d \
    --name clouddrive \
    --restart unless-stopped \
    --env CLOUDDRIVE_HOME=/Config \
    -v <path to accept cloud mounts>:/CloudNAS:shared \
    -v <path to app data>:/Config \
    -v <other local shared path>:/media:shared \
    --network host \
    --pid host \
    --privileged \
    --device /dev/fuse:/dev/fuse \
    cloudnas/clouddrive2

The three paths you fill in

  • <path to accept cloud mounts>/CloudNAS:shared

    Where cloud mounts appear. The shared flag is what lets them propagate back to the host.

  • <path to app data>/Config

    Configuration and data, matching CLOUDDRIVE_HOME=/Config. Without this volume, your setup is gone the moment the container is recreated.

  • <other local shared path>/media:shared

    Optional. Any other local directory on the host you want to manage from CloudDrive alongside your clouds.

Configuration

Open the console

http://<ip>:19798

Once the container is running, open that address on the host in a browser to register an account, add cloud storage and set up mount points. Everything else happens in that console — see Help.

Installing somewhere else?

Windows, Linux, macOS, Android and Synology/QNAP are all covered on these two pages.