Migrate a directory from a container to a native QNAP volume
by mackowiakp from LinuxQuestions.org on (#6GA7Y)
I have a NextCloud container on a QNAP NAS that has already grown to almost 40 GB and will grow about 1 GB per month.
The /config directory is already on the native QNAP volume, but /data remained in the container. This was default configuration of official image.
And the /data directory takes up almost all of these 40 GB. These are mainly document files and I would like to migrate with this directory to a native partition.
The database is MariaDB in a different container (not native QNAP) also used for other containers needs.
To do this, I used Portainer installed in docker-compose.
I used the following procedure:
- backup everything possible
- creating the /share/Container/nc-data/data directory
- disabling Nextcloud and MariaDB containers
- copying the contents of /share/Container/container-station-data/lib/docker/overlay2/<nextcloud_volume>/diff/data to the created dir /share/Container/nc-data/data using cp -a
- in Portainer I click on <nextcloud-3> and then <Duplicate/edit>
- also in Portainer I add the created directory from the host, i.e. /share/Container/nc-data/data as a bind mounted in the container to /data
- I click <Writable> and <Deploy the container>
- after some time, the <Invalid port specification> message appears in the upper right part of the screen
After starting the MariaDB and NextCloud containers, everything works but with the "old" contents of the /data directory
I do not change any other values and the existing ones (volumes, network including ports, etc.) are as they should be.
Portainer shows that the new container does not have the bind that I added earlier.
What am I doing wrong?
I am attaching screenshots.
Attached Thumbnails
The /config directory is already on the native QNAP volume, but /data remained in the container. This was default configuration of official image.
And the /data directory takes up almost all of these 40 GB. These are mainly document files and I would like to migrate with this directory to a native partition.
The database is MariaDB in a different container (not native QNAP) also used for other containers needs.
To do this, I used Portainer installed in docker-compose.
I used the following procedure:
- backup everything possible
- creating the /share/Container/nc-data/data directory
- disabling Nextcloud and MariaDB containers
- copying the contents of /share/Container/container-station-data/lib/docker/overlay2/<nextcloud_volume>/diff/data to the created dir /share/Container/nc-data/data using cp -a
- in Portainer I click on <nextcloud-3> and then <Duplicate/edit>
- also in Portainer I add the created directory from the host, i.e. /share/Container/nc-data/data as a bind mounted in the container to /data
- I click <Writable> and <Deploy the container>
- after some time, the <Invalid port specification> message appears in the upper right part of the screen
After starting the MariaDB and NextCloud containers, everything works but with the "old" contents of the /data directory
I do not change any other values and the existing ones (volumes, network including ports, etc.) are as they should be.
Portainer shows that the new container does not have the bind that I added earlier.
What am I doing wrong?
I am attaching screenshots.
Attached Thumbnails