Restore configuration in Docker

I did a copy of the old /config folder and after a fresh install I copied it inside the new container but it doesn’t seem to be enough because I don’t have the previous configuration.

What’s the best practice to backup and restore a configuration in Docker?

I found the solution, these are the commands:

Backup:

docker cp CONTAINER_ID:/var/syncthing/config/cert.pem /YOUR_LOCAL_DRIVE
docker cp CONTAINER_ID:/var/syncthing/config/config.xml /YOUR_LOCAL_DRIVE
docker cp CONTAINER_ID:/var/syncthing/config/key.pem /YOUR_LOCAL_DRIVE

Restore:

docker cp /YOUR_LOCAL_DRIVE/cert.pem CONTAINER_ID:/var/syncthing/config
docker cp /YOUR_LOCAL_DRIVE/config.xml CONTAINER_ID:/var/syncthing/config
docker cp /YOUR_LOCAL_DRIVE/key.pem CONTAINER_ID:/var/syncthing/config
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.