Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

devops - Using codeship to pull docker images from Github Conatiner Registry using the dockercfg file

apologies of this has been asked before. I have been going through the documentation for codeship to see if I can pull an image for docker from a private github container registry (GHCR) when I am automating my build process. The documentation specifies docker registries but nothing for the GHCR. Has anyone used Codeship to pull docker images from the GHCR? The documentation specifies that the most common way authenticate with image registries is to provide your account credentials via an encrypted dockercfg file. The example is as follows:

{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": "your_auth_string",
            "email": "your_email"
        }
    }
}

This file will later be encrypted as per the instructions in the docs which can be found here

I was wondering if anyone has used this for GHCR, and if they have my question is whether one can simply replace the URL with the GHCR URL and pass it the email and personal access token used to access the packages or in this case images in the GHCR?

question from:https://stackoverflow.com/questions/65847618/using-codeship-to-pull-docker-images-from-github-conatiner-registry-using-the-do

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

So after opening a ticket with Codeship and explaining to them what I was trying to do I got told the following:

"I don't think that we don't officially support the GitHub Container Registry; but, checking with the team on that. You likely can get it to work if it operates in a similar manner as the registries listed in the documentation."

I then tried it and it worked as expected. I also later received an email saying "The engineering team confirmed that this method should work for you. We are going to update out documentation soon with a proper guide".

In my case I had to create a credentials.env file, add the repository credentials and GHCR url instead of the method mentioned in the question to generate the dockercfg file since I am doing this on Mac OS because the newer versions of Docker have changed to store credentials in the macOS keychain rather than in a configuration file. The instructions can be found here

I hope this is useful to whoever comes across this in future until they have updated the documentation but as of 28th of January 2021, it has not yet been updated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...