Actually, I run my containers like this, for example :
docker run -v /nexus-data:/nexus-data sonatype/nexus3
^
After reading the documentation, I discover volumes that are completely managed by docker. For some reasons, I want to change the way to run my containers, to do something like this :
docker run -v nexus-data:/nexus-data sonatype/nexus3
^
I want to transfer my existing bind-mount to volumes.
But I don't want to lose the data into /nexus-data
folder, is there a possibility to transfer this folder, to the new volume, whitout restart everything ? Because I've also Jenkins and Sonar containers for example, I just want to change the way to have persistent data. There is a proper way to do this ?
You can try out following steps so that you will not loose your current nexus-data
.
#>docker run -v nexus-data:/nexus-data sonatype/nexus3
#>docker cp /nexus-data/. <container-name-or-id>:/nexus-data/
#>docker stop <container-name-or-id>
#>docker start <container-name-or-id>
docker cp
will copy data from your host-machine's /nexus-data
folder to container's FS /nexus-data
folder which is your mounted volume.
Let me know if you face any issue while performing following steps.