How to bake credential into docker image for git?

后端 未结 2 1721
粉色の甜心
粉色の甜心 2020-12-19 18:17

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

相关标签:
2条回答
  • 2020-12-19 18:40

    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

    0 讨论(0)
  • 2020-12-19 18:51

    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:

    • add ssh client to your docker image
    • generate an ssh key and copy it to the image. The ssh-agent part is not needed
    • register the key to the provider
    0 讨论(0)
提交回复
热议问题