33 lines
No EOL
623 B
Markdown
33 lines
No EOL
623 B
Markdown
|
|
---
|
|
creation date: 2022-09-03
|
|
tags: [docker,volume,operations,migration]
|
|
---
|
|
|
|
1. Stop existing deployment
|
|
2. Create a dedicated named docker volume with `docker volume create target-vol`
|
|
3. Copy existing contents
|
|
|
|
```shell
|
|
# copy
|
|
docker run -d --rm --name temp -v target-vol:/mnt alpine tail -f /dev/null
|
|
docker cp /opt/.../. temp:/mnt
|
|
|
|
# once finished
|
|
docker stop temp
|
|
```
|
|
|
|
4. Adapt existing deployment
|
|
|
|
```shell
|
|
# dedicated volumes section
|
|
volumes:
|
|
target-vol:
|
|
external: true
|
|
|
|
# change any mount paths
|
|
volumes:
|
|
- target-vol:/....
|
|
```
|
|
|
|
5. Adapt any backup scripts which would point to the old data host directory |