如何将凭据烘焙到git的docker映像中? [英] How to bake credential into docker image for git?

查看:83
本文介绍了如何将凭据烘焙到git的docker映像中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这实际上是我之前的一个.

我正在尝试使用docker托管个人笔记网络服务,并希望备份该服务生成的数据(我的笔记). 目前,我计划使用git提交,拉入并推送到存储库中.

I am trying to use docker to host a personal note-taking web service and want to backup data generated by the service (my notes). Currently I plan to use git to commit, pull, and push to a repository for my purpose.

要执行git pull and push,我的docker映像需要托管我的凭据.实现此目的最简单但最安全的方法是什么?

To do git pull and push, my docker image needs to host my credentials. What is the easiest yet safe way to achieve this?

到目前为止我所做的:

  • 我选择Alpine作为服务图像的基础图像.
  • 因为我只需要git的凭据,所以我认为将git凭据帮助器放入图像中可能会解决我的问题.我可以在构建期间将凭据保存到帮助程序中,并在运行时使用它们.
  • 根据
  • I choose Alpine as the base image of the image of my service.
  • Because I only need credentials for git, I think put a git credential helper into the image may solve my problem. I can save credentials to the helper during the build time and use them during runtime.
  • I googled a while and decided to use libsecret as my git credential helper, according to this article.
  • I have installed libsecret and set my git credential helper to be git-credential-libsecret

但是,到目前为止,我还无法使git-credential-libsecret功能正常.这是我遇到的几个问题:

However, I cannot make git-credential-libsecret functional so far. Here are a couple of problems that I encountered:

  • 首先,我测试了git-credential-libsecret get并得到以下错误:

CRITICAL **: could not connect to Secret Service: Cannot spawn a message bus without a machine-id: Unable to load /var/lib/dbus/machine-id or /etc/machine-id: Failed to open file */var/lib/dbus/machine-id*: No such file or directory

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆