Skip to content

Deploy with Docker

Prerequisites

Please refer to the Docker installation documentation to install Docker.

Get the Image

You can find all available tags on the cloudreve/cloudreve repository page.

Start

bash
docker run -d --name cloudreve -p 5212:5212 \
    -v ~/cloudreve/data:/cloudreve/data \
    cloudreve/cloudreve:latest

Container Volume

In the examples above, we mounted the host's ~/cloudreve/data directory to the container's /cloudreve/data directory with -v ~/cloudreve/data:/cloudreve/data, to make it easier to modify Cloudreve configuration files on the host. All additional files generated by Cloudreve (avatars, configuration files, temporary directories, etc.) will be stored in this directory by default.

Configure Database

In the startup commands above, we haven't configured a database, so Cloudreve will use SQLite to store data. If you need Cloudreve to connect to other databases, you can choose one of the following methods:

When starting the container, you can pass database configuration through environment variables:

bash
docker run -d --name cloudreve -p 5212:5212 \
    -v ~/cloudreve/data:/cloudreve/data \
    -e CR_CONF_Database.Type=postgres \
    -e CR_CONF_Database.Host=127.0.0.1 \
    -e CR_CONF_Database.Port=5432 \
    -e CR_CONF_Database.User=cloudreve \
    -e CR_CONF_Database.Password=cloudreve \
    -e CR_CONF_Database.Name=cloudreve \
    .....

The available configuration variables are:

Variable NameDescription
CR_CONF_Database.TypeDatabase type, supports postgres, mysql, sqlite
CR_CONF_Database.HostDatabase address
CR_CONF_Database.PortDatabase port
CR_CONF_Database.UserDatabase username
CR_CONF_Database.PasswordDatabase password
CR_CONF_Database.NameDatabase name
CR_CONF_Database.DBFileOptional, SQLite database file path
CR_CONF_Database.UnixSocketOptional, true or false, whether to use Unix Socket to connect to the database

Configure Redis

In the startup commands above, we haven't configured Redis, so Cloudreve will use built-in memory storage. If you need Cloudreve to connect to Redis, you can choose one of the following methods:

When starting the container, you can pass Redis configuration through environment variables:

bash
docker run -d --name cloudreve -p 5212:5212 \
    -v ~/cloudreve/data:/cloudreve/data \
    -e CR_CONF_Redis.Server=127.0.0.1:6379 \
    -e CR_CONF_Redis.Password=your_redis_password \
    -e CR_CONF_Redis.DB=0 \
    cloudreve/cloudreve:latest

The available configuration variables are:

Variable NameDescription
CR_CONF_Redis.ServerRedis address
CR_CONF_Redis.PasswordConnection password
CR_CONF_Redis.DBDatabase number, default is 0
CR_CONF_Redis.NetworkNetwork type, default is tcp, options include tcp, tcp4 (IPv4-only), tcp6 (IPv6-only), udp, udp4 (IPv4-only), udp6 (IPv6-only), ip, ip4 (IPv4-only), ip6 (IPv6-only), unix, unixgram, unixpacket
CR_CONF_Redis.UserRedis ACL username

Next Steps

At this point, Cloudreve has started successfully and is listening on port 5212. Please continue to the Next Steps page to complete your deployment.

Common Issues

Container cannot start?

First, find the restarting container, then check the logs:

bash
docker logs -f cloudreve

The main reasons for Cloudreve abnormal exit during startup are configuration issues. You can find relevant clues in the container logs. Common errors include:

  • Database configuration error;
  • Redis configuration error;
  • Authorization key error;
Cloudreve reports Please specify license key by ...

Please check whether you have correctly set the CR_LICENSE_KEY environment variable before starting. Its value should be the authorization key obtained from the Pro license management panel.

I configured database or Redis when starting the container. How do I modify the configuration later?

Configuration items passed through environment variables when starting the container cannot be modified later by editing the conf.ini file. You can start a new container with the new configuration, just make sure to mount the /cloudreve/data to the same directory as the old container. That is, keep -v ~/cloudreve/data:/cloudreve/data unchanged.

How to upgrade Cloudreve?

Since Cloudreve stores all configuration and data in the /cloudreve/data Volume, we just need to create a new container with the new image and mount the same Volume.

bash
# Stop the currently running container
docker stop cloudreve

# Remove the currently running container
docker rm cloudreve

# Create a new container with the new image and mount the same Volume
docker run -d --name cloudreve -p 5212:5212 \
    -v ~/cloudreve/data:/cloudreve/data \ # Make sure this is the same as the previous startup
    # Other configuration parameters, the same as the previous startup
    cloudreve/cloudreve:latest

You also need to refer to the Upgrade Cloudreve page to complete the subsequent process.