gpt4 book ai didi

docker - docker撰写备份bitnami redmine卷

转载 作者:行者123 更新时间:2023-12-02 21:25:08 29 4
gpt4 key购买 nike

我启动了一个bitnami redmine container(通过docker-compose),登录以重新命名并创建了一个用户。

此时,备份/还原系统的过程是什么?

之后,我希望能够做一个新的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.

关于docker - docker撰写备份bitnami redmine卷,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39678324/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com