Search code examples
azure-web-app-serviceazure-webappsgithub-package-registryazure-web-app-for-containers

How to deploy docker image from Github Package Registry to Azure Web Apps


I have Github Package Registry about Docker Image. I want to deploy it to Azure Web Apps. I try the setup like this,

  1. Server URL: https://docker.pkg.github.com
  2. Full Image Name & Tag: berviantoleo/my-telegram-bot/my-telegram-bot:latest

I'm not fill the username & password, because it is public docker image. I also already try to bring username & password, but no luck, still failed to pull.

I see from the logs, it have logs like this:

2020-11-16T02:46:04.868Z INFO  - Pulling image from Docker hub: berviantoleo/my-telegram-bot/my-telegram-bot:latest

It's very weird because I already change the Server URL, is it the Server URL only support Docker Hub? I need help about this. I already try from Dockerhub, yeah, it can be deployed. But for now, I want to try from Github Packages Registry.

Update:

  • I've made mistake, the fullname should be: docker.pkg.github.com/berviantoleo/my-telegram-bot/my-telegram-bot:latest need include the docker.pkg.github.com

  • When change to private repository and provide username and password, it can pulled the image.

  • When public repository, it still need username and password, maybe because I misunderstand about the package. I think docker.pkg.github.com still need to be authenticated. I get this log:

     2020-11-18T03:33:57.973Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://docker.pkg.github.com/v2/berviantoleo/tele-bot/tele-bot/manifests/latest: no basic auth credentials"}
    
  • I still need to find solution that no need username and password.


Solution

  • Well, if you pull the image from the public registry then you do not need to set the credential, and by default, the public registry is the docker hub. For other registries, private registry, you need to set the environment variable DOCKER_REGISTRY_SERVER_URL to tell the Web App to pull images from it. And set the DOCKER_REGISTRY_SERVER_USERNAME and DOCKER_REGISTRY_SERVER_PASSWORD for the credential. For a quick test, the image you used should be in the private registry. So you need to set the credential for it.