[func] How to push container image to Azure Container Registry?

551 views
Skip to first unread message

warw...@gmail.com

unread,
Dec 2, 2021, 10:27:33 PM12/2/21
to Knative Users
Hi,

I'm trying to deploy my func to AKS but pushing image to ACR is the broker at this point:

$ kn-func deploy -v
.....
(snip)
Deploying function

Pushing function image to the registry

The push refers to repository [myrepo.azurecr.io/kn-func-python] (100%)

83d85471d9f8: Preparing (100%)

20e4c1d943b6: Preparing (100%)

126dd5439845: Preparing (100%)

29da934a46fc: Preparing (100%)

b653d1937b4b: Preparing (100%)

46fcc6c6a092: Preparing (100%)

fce641ee9ce0: Preparing (100%)

b2c56340ef82: Preparing (100%)

783e905a53ec: Preparing (100%)

36ec8b35e5ce: Preparing (100%)

73b515a97fed: Preparing (100%)

d7ecef9dcc97: Preparing (100%)

bc7bdf0ec1b9: Preparing (100%)

b2c56340ef82: Waiting (100%)

783e905a53ec: Waiting (100%)

36ec8b35e5ce: Waiting (100%)

bc7bdf0ec1b9: Waiting (100%)

73b515a97fed: Waiting (100%)

d7ecef9dcc97: Waiting (100%)

46fcc6c6a092: Waiting (100%)

fce641ee9ce0: Waiting (100%)

Error: unauthorized: Application not registered with AAD.

----

Can't find out how to configure credentials to kn-func.


Thanks,

Youngwoo

Mauricio Salatino

unread,
Dec 3, 2021, 3:18:26 AM12/3/21
to warw...@gmail.com, Knative Users
Can you do : 

> docker push <image> 

to that registry? 


--
You received this message because you are subscribed to the Google Groups "Knative Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knative-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/knative-users/04bb9f5d-4274-437b-b628-797460c74122n%40googlegroups.com.


--
 - Blog: http://salaboy.com
 - Twitter: http://twitter.com/salaboy
 
 - Mauricio "Salaboy" Salatino -

Mauricio Salatino

unread,
Dec 3, 2021, 3:22:10 AM12/3/21
to warw...@gmail.com, Knative Users
This is a related issue, but not the same, as this is to consume images from private registries in the cluster. 




warw...@gmail.com

unread,
Dec 3, 2021, 3:44:36 AM12/3/21
to Knative Users
Hey Mauricio,

Yes I can push the container image to ACR using docker cli on my env.:

$ kn-func build

   🙌 Function image built: myrepo.azurecr.io/kn-func-python:latest

$ docker push myrepo.azurecr.io/kn-func-python:latest

......

It works.

And also, I'm not sure #497 is the related issue for using 'kn-func deploy'.

I have no trouble with running knative services using images from ACR for now. I've deployed appropriate secrets for the ACR to kubernetes cluster.


Thanks,

Youngwoo


2021년 12월 3일 금요일 오후 5시 22분 10초 UTC+9에 sal...@gmail.com님이 작성:

Anderson Soares

unread,
Dec 3, 2021, 3:47:48 AM12/3/21
to Knative Users
Hello,

If you want you can test first pushing  an image using Docker.

#Docker login

docker login <your-acr-name-here>.azurecr.io

# In case you need Admin credentials.

Go to your Azure portal, access your Container Registry, click over keys, enable the admin access in case not enabled, copy the user and pass and use in your login.

#Create build

docker build -t myimage/prettyimage:latest

# Add image tag

docker tag myimage/prettyimage:latest  <your-acr-name-here>.azurecr.io/myrepo/myimage

# Push image

docker push <your-acr-name-here>.azurecr.io/myrepo/myimage


# Now let's say that you want to pull your image via knative.
# Make sure your AKS cluster has the grants, you can use Azure CLI for that first.

az aks update -n myAKSCluster -g myResourceGroup --attach-acr <acr-name>

# Then you can create a secret to allow Knative pull acr images using the docker-registry library.


kubectl create secret docker-registry acr-pull-secret --docker-server=
<your-acr-name-here>.azurecr.io --docker-username=<USERNAME> --docker-password=<PASSWORD>


# Then in your yaml file you can all the imagePullSecrets via the spec block, so just add something like below:

      imagePullSecrets:

      - name: acr-pull-secret


It should work nice.

Cheers,

warw...@gmail.com

unread,
Dec 3, 2021, 4:06:03 AM12/3/21
to Knative Users
Hey, 
Thanks for the detailed instructions for Azure.
I've already configured my aks to pull docker images from acr so I don't have any problems to deploy my knative services.

Docker cli works fine on my dev env. so It's strange for me that knative func 'deploy' command can't push the image to acr.

Thanks,
Youngwoo

2021년 12월 3일 금요일 오후 5시 47분 48초 UTC+9에 soaresan...@gmail.com님이 작성:

warw...@gmail.com

unread,
Dec 3, 2021, 5:37:09 AM12/3/21
to Knative Users
Hi,

I've evaluated 3 different docker registries: ACR, private registry(nexus based) and docker.io
All of registries works fine for me to pull/push images from my local to remote using Docker CLI. For 'kn-func deploy', docker.io is working but. the others are not. Pushing image to remote(acr/nexus) failed.
Looks like it failed getting creds from docker but I'm not sure.

Thanks,
Youngwoo

2021년 12월 3일 금요일 오후 6시 6분 3초 UTC+9에 warw...@gmail.com님이 작성:

Mauricio Salatino

unread,
Dec 3, 2021, 6:19:57 AM12/3/21
to warw...@gmail.com, Knative Users
Interesting.. if we can reproduce the issue. it will be great to open an issue. 

--
You received this message because you are subscribed to the Google Groups "Knative Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knative-user...@googlegroups.com.

Lance Ball

unread,
Dec 3, 2021, 8:35:37 AM12/3/21
to Knative Users
"Error: unauthorized: Application not registered with AAD."

This is the interesting part of the error message to me. It's not saying your credentials are wrong. It's saying that the application is not registered. I don't exactly know what that means in this context, but I wonder if this is useful information.

warw...@gmail.com

unread,
Dec 3, 2021, 1:11:28 PM12/3/21
to Knative Users
Lance,

"Error: unauthorized: authentication required"

I got above message when I changed docker registry to Nexus. (private registry)

And also, GCR(google container registry) works fine on my end as well.

Thanks,
Youngwoo

2021년 12월 3일 금요일 오후 10시 35분 37초 UTC+9에 Lance Ball님이 작성:
Reply all
Reply to author
Forward
0 new messages