TomBlo
TomBlo

Reputation: 118

configure Azure ContainerInstance to use self hosted registry

I'm currently testing Azure and i tried to deploy my own docker image. The image is hosted on a registry on my VServer. The registry is using port 5000. When I try to provide the .yaml file with proper imageRegistryCredentials it fails.

Image registry credentials:
- server: my.server.com:5000
  username: me
  password: abc123

az container create -g My group --file myconainer.yaml returns:

The server 'my.server.com:5000' in the 'imageRegistryCredentials' of container group 'MyContainerGroup' is Invalid. 
It should be a valid hostname without protocol.

And if I do not provide a port I can not login to the registry. What am I doing wrong?

Upvotes: 1

Views: 4681

Answers (1)

Charles Xu
Charles Xu

Reputation: 31454

When you create the Azure container Instance from a private container registry, then the container registry should be accessed from the Internet, at least the Azure can access it, not just can be accessed from the private network.

If not, I suggest you can push your image to Azure Container Registry, then create the Azure container Instance from it. It's also a private registry. And it has great access control.

If you have more questions, please let me know. I'm glad to provide more help.

Update

The definition of the property of the imageRegistryCredentials in the Azure Template, it's also the same means in the yaml file. It does not need the port, just the server name. I can reappear the error you got if add the port.

enter image description here

Try just add the registry server name without the port like this:

apiVersion: 2018-10-01
location: eastus
name: azureContainerGroup
properties:
  containers:
  - name: aci-tutorial-app
    properties:
      image: charlesacr.azurecr.io/nginx:v1
      resources:
        requests:
          cpu: 1
          memoryInGb: 1.5
      ports:
      - port: 80
  osType: Linux
  ipAddress:
    type: Public
    ports:
    - protocol: tcp
      port: '80'
  imageRegistryCredentials:
    - server: charlesacr.azurecr.io
      username: charlesACR
      password: xxxxxxxxxx
tags: null
type: Microsoft.ContainerInstance/containerGroups

Update-2

With the test, finally, I find that Azure Container Instance does not support the private registry with certificate currently, it just supports the private registry with username and password. Maybe it will support in the future, but not now. So if you want to use the private registry, then you need to delete the certificate authenticate.

You can always raise your feedback over this link: https://feedback.azure.com/forums/602224-azure-container-instances.

Upvotes: 5

Related Questions