DEV Community

dom
dom

Posted on

Docker backups/migration using rclone

stop all containers:

docker stop $(docker ps -q)

rclone copy for file copy, or sync if to have exact match as in source server.
rclone follows the logic of first input being from, second input being to (in this case newserver as configured using rclone config, though you can also use backend: and passing in the required credentials that backend requires, if you don't want to setup rclone config file)

rclone copy /opt/stacks/ newserver:/opt/stacks/ -P -L (because i use dockge)

rclone copy /var/lib/docker/volumes newserver:/var/lib/docker/volumes -P -L \
--exclude '**/*.sock' \
--exclude '**/casper' \
--exclude '**/source'

test if works in new server or resume run of services

start container (if backup)
docker start $(docker ps -a -q)

Top comments (0)