This is actually a question following from my previous one .
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.
To do git pull and push, my docker image needs to host my credentials. What is the easiest yet safe way to achieve this?
What I have done so far:
Alpine
as the base image of the image of my service. libsecret
as my git credential helper, according to this article . libsecret
and set my git credential helper to be git-credential-libsecret
However, I cannot make git-credential-libsecret
functional so far. Here are a couple of problems that I encountered:
Firstly, I tested git-credential-libsecret get
and get the following error:
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
dbus
and run dbus-uuidgen > /var/lib/dbus/machine-id
Then I try to run git-credential-libsecret get
again. This time, it reports that:
CRITICAL **: could not connect to Secret Service: Cannot autolaunch D-Bus without X11 $DISPLAY
dbus-x11
and run dbus-launch --sh-syntax
( from here ) but with no luck this time. The error continues. In conclusion, I would like to know:
If your git provider supports ssh with public keys, I think the easiest way would be to switch to them. You would also not have to copy around your password.
You need to:
ssh-agent
part is not needed It depends on where you are running git-credential-libsecret: you need to have it installed in your image/container, not on the host.
Note that another option would be to use a volume (see my answer to your previous question ), in which case, git
could be installed only on the host.
But here, you would use git directly in your image, which means, as in this Dockerfile , you need to have in your Dockerfile:
RUN apt-get update -y &&
apt-get install --no-install-recommends -y libsecret-1-0 git
https://github.com/electron-userland/electron-builder/blob/master/docker/base/Dockerfile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.