Update Scripts/Bash/Transfer Docker Containers.md

This commit is contained in:
Nicole Rappe
2024-04-11 00:03:21 -06:00
parent e7b8f4152f
commit ed3de74200

View File

@ -3,16 +3,36 @@ If you find that you need to migrate a container, along with any supporting file
Be sure to perform the following steps to make sure that you can copy the container's files. Be sure to perform the following steps to make sure that you can copy the container's files.
On the destination (new) server, the directory needs to exist and be writable via the person copying the data over SSH: On the destination (new) server, the directory needs to exist and be writable via the person copying the data over SSH:
```
=== "Safe Method"
``` sh
sudo mkdir -p /srv/containers/example sudo mkdir -p /srv/containers/example
sudo chmod 740 /srv/containers/example sudo chmod 740 /srv/containers/example
sudo chown nicole:nicole /srv/containers/example sudo chown nicole:nicole /srv/containers/example
``` ```
=== "Quick & Dirty Method"
``` sh
sudo mkdir -p /srv/containers
sudo chmod 777 /srv/containers
```
!!! warning !!! warning
You need to stop the running containers on the old server before copying their data over, otherwise the state of the data may be unstable. Once you have migrated the data, you can spin up the containers on the new server and confirm they work before deleting the data on the old server. You need to stop the running containers on the old server before copying their data over, otherwise the state of the data may be unstable. Once you have migrated the data, you can spin up the containers on the new server and confirm they work before deleting the data on the old server.
On the source (old) server, perform an rsync over to the new server, authenticating yourself as you will be prompted to do so: On the source (old) server, perform an rsync over to the new server, authenticating yourself as you will be prompted to do so:
```
=== "Safe Method"
``` sh
rsync -avz -e ssh --progress /srv/containers/example/* nicole@192.168.3.30:/srv/containers/example rsync -avz -e ssh --progress /srv/containers/example/* nicole@192.168.3.30:/srv/containers/example
``` ```
=== "Quick & Dirty Method"
``` sh
rsync -avz -e ssh --progress /srv/containers/example nicole@192.168.3.30:/srv/containers
```