Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Document github container registry authentication without docker #2784

Open
koliyo opened this issue Sep 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@koliyo
Copy link

koliyo commented Sep 17, 2024

Proposal

I was struggling with login in to our github container registry because the ghcr.io/atc0005/go-ci image does not have the docker binary. I did however find a working solution, by handcrafting a .docker/config.json as mentioned here: https://golang.testcontainers.org/features/docker_auth/

But having explicit instructions how to actually do it for github actions would be very helpful. So I suggest adding the following setup as an example in a github action workflow:

    - name: Docker registry login
      run: |
        mkdir -p $HOME/.docker
        AUTH_BASE64=$(echo ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64)
        echo '{"auths":{"ghcr.io":{"auth":"{#}"}}}' | sed "s/{#}/$AUTH_BASE64/g" > $HOME/.docker/config.json

This will work with testcontainers even if the host container does not contain the docker binary.

@koliyo koliyo added the enhancement New feature or request label Sep 17, 2024
@mdelapenya
Copy link
Member

Hi @koliyo, thanks for raising this issue. We already explain in https://golang.testcontainers.org/features/docker_auth/ the different mechanisms to discover the Docker auth, but I'm not against adding custom examples for how to achieve what you did.

Do you mind submitting a PR to the docs site, to that page? I could imagine adding it at the end of the page with something like this:

## Docker Auth examples

### Creating a custom Docker config file
(...your code snippet...)

I think the matter of being GHCR or any other site it's an implementation detail, so I'd not create a dedicated entry for GHCR, but use it as the code snippet for a general way for building the auth config file.

Wdyt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants