LoginSignup
24
14

More than 5 years have passed since last update.

Docker で Volume 名を変更する

Posted at

Docker では Volume 名の変更は気軽にできない。

変更できるようにしてほしいという要望は昔から上がっているが、今のところ実装される見込みはないようだ。

Rename docker volume · Issue #31154 · moby/moby

Issue でも言及されているが「新しい Volume に全てコピーして古い方を消す」ことで Volume 名の変更に相当する操作が行える。

$ docker volume create --name <new_volume>
$ docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine sh -c "cp -av /from/* /to"
$ docker volume rm <old_volume>
24
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
14