docker 编写备份 bitnami redmine 卷
docker compose backup bitnami redmine volume
我启动了一个 bitnami redmine container(通过 docker-compose),登录到 redmine 并创建了一个用户。
此时 backup/restore 系统的程序是什么?
我希望之后能够做一个新的 docker-compose up
,但使用备份卷,其中包含我创建的用户。
我尝试备份卷文件夹 (/var/lib/docker/volumes/docker_mariadb_data),然后将其替换到新容器中,但此过程无效。
您可以使用 mysqldump
备份您的数据库
docker exec some-mysql sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql
这将在您的主机系统上生成一个备份。然后,您可以装载数据,以便 mysql
映像将导入它、创建数据库,并在初始创建数据库容器时提取数据。
查看 mysql
Docker 图像文档:
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.
您可以 backup/restore 您的 bitnami redmine 容器 persisting volumes。
只需将 docker-compose.yml 中的 'mariadb_data' 和 'redmine_data' 替换为您希望持久保存数据的本地目录。
我启动了一个 bitnami redmine container(通过 docker-compose),登录到 redmine 并创建了一个用户。
此时 backup/restore 系统的程序是什么?
我希望之后能够做一个新的 docker-compose up
,但使用备份卷,其中包含我创建的用户。
我尝试备份卷文件夹 (/var/lib/docker/volumes/docker_mariadb_data),然后将其替换到新容器中,但此过程无效。
您可以使用 mysqldump
docker exec some-mysql sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql
这将在您的主机系统上生成一个备份。然后,您可以装载数据,以便 mysql
映像将导入它、创建数据库,并在初始创建数据库容器时提取数据。
查看 mysql
Docker 图像文档:
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.
您可以 backup/restore 您的 bitnami redmine 容器 persisting volumes。
只需将 docker-compose.yml 中的 'mariadb_data' 和 'redmine_data' 替换为您希望持久保存数据的本地目录。