Using docker to install nextcloud, how to modify the data storage location?

  docker, question

docker-compose.yml

version: '2'
 services:
 db:
 container_name: cloud_db
 image: mysql
 volumes:
 - "./data/cloud/mysql:/var/lib/mysql"
 restart: always
 environment:
 MYSQL_ROOT_PASSWORD: pwd
 MYSQL_DATABASE: nextcloud
 app:
 container_name: cloud_app
 depends_on:
 - db
 image: nextcloud
 volumes:
 - ./data/cloud/config:/var/www/html/config
 - ./data/cloud/data:/var/www/html/data
 - ./data/cloud/apps:/var/www/html/apps
 links:
 - db
 ports:
 - "2333:80"
 restart: always
 ...

Synchronized documents will be stored in

./data/cloud/data:/var/www/html/data

If I use

docker rm id

If the container is deleted, will the synchronized data also be lost?

My server was built in Vultr and usedBlock Storage
Now you want to migrate your data toBlock StorageChina,
ReferencesMove OwnCloud’s storage space to block storage
Need to modify

/var/www/html/config/config.php

'datadirectory' => '/var/www/html/data',

For

'datadirectory' => '/mnt/blockstorage/nextcloud',

Can I write it directly ondocker-compose.ymlChinese?

- ./data/cloud/data:/mnt/blockstorage/nextcloud

There is no need to change the configuration file inside

With volume, you don’t have to worry about deleting containers and losing images.

Want to have dataBlock StorageAbove

This is written in docker-compose

/mnt/blockstorage/nextcloud:/var/www/html/data

Just do it. there is no address /mnt/blockstorage/nextcloud in the container. if you change it this way, you will be reported wrong.