Is it possible to rename a docker volume? I want to change the volume names of the existing container. I see that config.json
and hostconfig.json
has the volume details in it.
docker run -di -p 8083:443 -v app_main_db_test_1:/var/lib/pgsql/data -v app_main_conf_test_1:/var/www/ ubuntu
I want to change app_main_db_test_1
to app_main_db
and app_main_conf_test_1
to app_main_conf
3
Answers
Figured it out. Thanks to this github post.
as far as i know there are no ways of renaming docker volume so far. There is an open github issue, which indicates there is no solution to the topic yet.
But there are a few useful ways how to do so. Since you are saying you use Docker Desktop you could check this comment:
Which should do exactly what you are planning to do.
Please don’t try this on a production machine, however on my dev machine (ubuntu), i had two containers:
I wanted to switch volumes like this
My docker volumes are located in /home/docker/volumes, in your case it might be /var/lib/docker/volumes
I just renamed the volumes
Restarted the containers which indeed switch the containers