Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Github Docker container action referencing an image on Github Packages

Is it possible to create a github action from a docker image stored on Github Packages?

action.yml:

runs:
  using: 'docker'
  image: 'docker://docker.pkg.github.com/<you>/<your-repo>/<image>:<version>'

It seems to be no way to provide docker basic auth credentials for now.

Error message:

  Pull down action image '[...] '
  /usr/bin/docker pull [...] 
Error response from daemon: Get https://[...]: no basic auth credentials
  ##[warning]Docker pull failed with exit code 1, back off 9.515 seconds before retry.
  /usr/bin/docker pull [...] 
Error response from daemon: Get [...]: no basic auth credentials
  ##[warning]Docker pull failed with exit code 1, back off 2.011 seconds before retry.
  /usr/bin/docker pull [...] 
Error response from daemon: Get [...]: no basic auth credentials
##[error]Docker pull failed with exit code 1
like image 711
Loicmdivad Avatar asked Nov 25 '25 04:11

Loicmdivad


1 Answers

Sorry for the delay on this!

I've reached the GitHub support and apparently what I'm trying to do here is not possible yet, but will arrive soon. I'm joining here part of the response from the Github Developer Support:

Thanks for writing back to clarify! For the image attribute in a workflow file, it's not possible to specify a Docker image hosted in GitHub Packages the same way you could a cached container image or an image hosted on Docker Hub. Given this example workflow file snippet, there isn't a way to specify authorization credentials in the workflow file

That's because authentication is required to install packages from GitHub Packages currently. Whether it's from your CI or your local machine, when fetching artefacts from Github Packages you will need to authenticate. This still true for public repositories.

Finally

As a workaround, you could use GitHub Actions to publish your package to both Docker Hub and GitHub Packages. If you want to use that package in a GitHub Actions workflow, like for a service or to run the workflow in a container, you could reference its Docker Hub URL.

For example, I've applied these recommendations to the GitHub Action schema-validation

like image 165
Loicmdivad Avatar answered Nov 28 '25 00:11

Loicmdivad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!