Migrate Docker Volume From Win11 to Debian11
Contents
Backup images, volumes in Win11
|
|
Restore on Debian11
|
|
Issues
volume already exists but was not created by Docker Compose. Use
external: true
to use an existing volume1 2 3
volumes: taiga-static-data: external: true
volume doesn’t exist
1 2 3 4
volumes: taiga-static-data: external: true name: taiga-docker_taiga-static-data
吐槽
docker compose创建volume时,会在compose.yml文件里定义的volume名称前面加上当前项目名(文件夹名)。比如说,你在目录~/project/compose.yml里定义如下的volume:
|
|
当你运行docker compose up 创建容器时,新建的volume名称实际上是project_taiga-static-data
。
在新机器上恢复volume数据之后,再次回到之前的项目~/project/ 运行docker compose up
时,提示
|
|
加上external:true之后,又提示volume doesn’t exist。感觉有点死循环了。无奈,再加一个name,暂时解决这个问题。
Reference
Author Paisen
LastMod 2025-10-13