0

I started a bitnami redmine container (via docker-compose), logged in to redmine and created one user.

What's the procedure to backup/restore the system at this point?

I would like to be able to do a fresh docker-compose up afterwards but using the backup volume, the one which has the user I created.

I tried to backup the volume folder (/var/lib/docker/volumes/docker_mariadb_data) and then replace it in the new container but this procedure didn't worked.

KcFnMi
  • 5,516
  • 10
  • 62
  • 136

2 Answers2

1

You can backup your DB using mysqldump

docker exec some-mysql sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql

This will produce a backup on your host system. You can then mount the data so the mysql image will import it, create the DB, and ingest the data on initial creation of the DB container.

See the mysql Docker image documentation:

https://hub.docker.com/_/mysql/

Initializing a fresh instance

When a container is started for the first time, a new database with the specified name will be created and initialized with the provided configuration variables. Furthermore, it will execute files with extensions .sh, .sql and .sql.gz that are found in /docker-entrypoint-initdb.d. Files will be executed in alphabetical order. You can easily populate your mysql services by mounting a SQL dump into that directory and provide custom images with contributed data.

Community
  • 1
  • 1
DevOps Dan
  • 1,724
  • 11
  • 11
  • Ok, got it. But the bitnami redmine container (https://github.com/bitnami/bitnami-docker-redmine) uses MariaDB (https://github.com/bitnami/bitnami-docker-mariadb) which don't appear to have the same initialization mechanism. Is there any way around MariaDB? – KcFnMi Sep 24 '16 at 21:16
  • Anyway, this (http://www.redmine.org/projects/redmine/wiki/HowTo_Migrate_Redmine_to_a_new_server_to_a_new_Redmine_version) was very helpful to me. – KcFnMi Sep 26 '16 at 09:46
1

You can backup/restore your bitnami redmine container by persisting volumes.

Just replace 'mariadb_data' and 'redmine_data' in your docker-compose.yml with the local directories where you want the data to be persisted.

jloramas
  • 11
  • 1