Say, folder with docker-compose files was renamed or we do merging volumes etc. Then we shall rename docker volume. Because docker natively does not support renaming, we shall create it, then copy data, then inspect new volume, test and delete old one at the end
Volumes:
docker volume ls
DRIVER VOLUME NAME
local andrius_mysql <-- old
local databases_mysql <-- new
Copyng data with permissions and user owenship info, at the end sh
will be executed to inspect data:
docker run -ti --rm \
-v andrius_mysql:/db/old \
-v databases_mysql:/db/new \
alpine sh -c 'apk --update --no-cache add rsync mc && rsync -avzrP /db/old/ /db/new && sh'