I have a container registry which is only accessible through a private endpoint and resides in a virtual network, let’s say ‘Vnet’. The registry is not accessible through the public internet. And I have linked my Github Repo to the azure devops.
What I am trying to do:-
I am trying to create a pipeline to build the image of a github project and push it to the private container registry.
What I have done currently:-
I am running the pipeline on a self hosted agent VM inside the ‘Vnet’, the same virtual network on which the container registry resides. This VM doesn’t have a public IP address and hence there can be no inbound connections to it over the public internet. I have tested and confirmed that the VM can access the registry through the private network.
The Azure pipeline can’t push the image to the container registry. It says that the client with IP ‘xx.xx.xx.xx’ is not allowed access. It means that it is trying to push the image to the registry over the public internet instead of using the private network.
Below is the relevant part of the code from the azure pipeline:-
task: [email protected] displayName: Build and push an image to container registry inputs: command: buildAndPush repository: $(imageRepository) dockerfile: $(dockerfilePath) containerRegistry: 'ContainerRegistry' tags: | $(tag)
Is it because of the service connection string which should not be used in this case? I have tested with the default service connection for the azure container registry and it failed.
I then also changed the service connection to use the custom container url, like
<docker_container>.azureacr.io and provided the
docker password of that repository explicitly but that still doesn’t work.
Can someone please explain where I am going wrong and what is the right way to do it? I would be highly indebted to you. Thanks!
Source: Docker Questions