A
nightmare comes true. I google around for a couple of hours to move my running Redmine installation from one server to a new one. There were many suggestions on the google but none worked for me as those were either out dated or incomplete.
In this article we will backup a running Redmine installations with docker-compose from one host to another. As this is more a generic way of backup & restoring docker images it might work for other applications using docker containers. However this approach has been tested for Redmine with Ubuntu servers ( v18.04, v22.04) only.
Backup
- You need to backup two things: the container and its volume data
- Backing up container as new image
-
docker-compose ps docker commit redmine_redmine_1, will give a hash, use it below docker tag 818d074ec46f29ec0c9e2093ab57b0f redminee:v1 docker images docker-compose ps docker commit redmine_postgres_1 docker tag e90f7736dfb316338abc8621296ac448ac postgresee:v1 docker images docker save redminee:v1 -o redminee.tar docker save postgresee:v1 -o postgresee.tar
- Backing up volume data
- Find out location of volume: docker inspect redmine*redmine-data, syntax:
<directory>_<volume_in_compose_file>
-
sudo -i tar cvf redmine_redmine-data.tar redmine_redmine-data/ tar cvf redmine_redmine-postgres-data.tar redmine_redmine-postgres-data/
Restore
- Restoring volume data
-
sudo -i cd /var/lib/docker/volumes/ tar xvf redmine_redmine-data.tar tar xvf redmine_redmine-postgres-data.tar chown systemd-coredump:systemd-coredump redmine_redmine-* -Rf
- Restoring images
-
docker images, no image exists with the same name docker load < redminee.tar docker load < postgresee.tar docker images
Settings
- Change docker compose file to use images
- postgresee:v1
- redminee:v1
- Start
- docker-compose up
- Browse to http://localhost:7071