testcontainers-go
testcontainers-go copied to clipboard
[Enhancement]: Document github container registry authentication without docker
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.