Skip to content

Instantly share code, notes, and snippets.

@MahdiAkrami01
Last active July 24, 2025 14:53
Show Gist options
  • Save MahdiAkrami01/94df5bdee132d109c4e74b3b46eba214 to your computer and use it in GitHub Desktop.
Save MahdiAkrami01/94df5bdee132d109c4e74b3b46eba214 to your computer and use it in GitHub Desktop.
How to rename a Docker volume

How to rename a Docker volume

  1. Create a new volume
sudo docker volume create newvolume
  1. Delete _data from the new volume
sudo rm -rfv /var/lib/docker/volumes/newvolume/_data
  1. Moving _data from the old to the new volume
sudo mv /var/lib/docker/volumes/oldvolume/_data /var/lib/docker/volumes/newvolume/
  1. Delete the old volume
sudo docker volume rm oldvolume

Credit: https://www.reddit.com/r/docker/comments/wzc4i0/rename_docker_volume/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment