|
tags: ${{ github.repository }}:latest |
I think the above line requires modification if the user's GitHub and Docker Hub usernames don't match. It might be worth noting in the CI/CD portion of the tutorial.
I'd be happy to submit a PR, but I think my own solution is a bit of a hack and probably not what you want either here or in the tutorial. I'm sure there's a smarter way to use secrets.DOCKER_HUB_USERNAME
, but I can't figure it out.
I'm also not sure whether the PR should start with the code repo or the tutorial repo, so I figured I'd start with a discussion here first.
More details below.
First, this is such a useful tutorial. The CI/CD portion particularly has been tremendously helpful. I'm new to Docker (hence going through tutorials) and had no real intuition for how people were using it for CD in particular. The tutorial's style and simple examples have brought me a long way. Thank you.
Now to the issue:
The release workflow was failing during the Build and push Docker image
step with the following:
#12 pushing dodsonmg/docker-gs-ping:latest with docker
#12 pushing layer bb0e01146d01
...
#12 pushing layer 72e830a4dff5 0.3s done
#12 ERROR: denied: requested access to the resource is denied
------
> pushing dodsonmg/docker-gs-ping:latest with docker:
------
error: denied: requested access to the resource is denied
Error: buildx failed with: error: denied: requested access to the resource is denied
For no useful reason, I had different usernames for GitHub and Docker Hub. ${{ github.repository }}
resolves to dodsonmg/docker-gs-ping
(as you can see above...); however, since dodsonmg
wasn't my Docker Hub username, the push was failing, despite the fact that the Login to Docker Hub
step was passing.
I modified the line to:
tags: md403/docker-gs-ping:latest
(md403
being my Docker Hub username) and it worked fine.
Thankfully, my GitHub username is also available on Docker Hub, so I changed it and the repo code works as expected without modifications.