Docker 上的 GitLab:如何在部署之间保留用户数据? [英] GitLab on Docker: how to persist user data between deployments?
问题描述
我使用的是官方的 GitLab Docker 镜像.
I am using the official GitLab Docker image.
我想在我的 GitLab 容器中提供预配置的用户帐户以用于测试.
I want to have pre-configured user accounts available in my GitLab container to be used for tests.
但是用户帐户保存在一个卷中,所以我不能在创建我的测试用户后只 commit
和 push
GitLab 图像.
But user accounts are saved in a volume, so I can't just commit
and push
the GitLab image after having created my test users.
那么:我应该如何持久化它们?
一种方法是在每次新部署后使用 API 在启动时创建它们,但这很慢/很麻烦.
One way would be to create them on startup using the API after each new deployment, but this is quite slow/cumbersome.
推荐答案
正如你所说,由于 gitlab-ce 和 gitlab-ee 镜像中声明了 VOLUME,它不会像提交和推送 Docker 镜像那么简单.
As you said, it's not going to be as easy as committing and pushing a Docker image because of the VOLUMEs declared in the gitlab-ce and gitlab-ee images.
也许您可以备份和恢复实例?那么,创建您想要的状态的备份,包括预配置的帐户,然后在新的 GitLab 容器启动后将其恢复到?
Perhaps you can backup and restore the instances? So, create a backup of the state you want including the pre-configured accounts, and then restore that onto new GitLab containers after they're started?
这篇关于Docker 上的 GitLab:如何在部署之间保留用户数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!