1

I have an application that uses OpenFaaS.

In particular, I'm using faasd because the function will run on devices with poor processing capacity. I have a private registry on which an image of an 'X' function is present. I want to pull this image from faasd to deploy and execute it, but I'm facing a problem: it seems like I'm not authenticated when I try to perform the action, but I pass correctly the registryAuth token.

Here there is an example of what I'm doing (following this https://ericstoekl.github.io/faas/operations/managing-images/#deploy-functions-with-private-registries-credentials)

POST

<ip_address>:8080/system/functions

Headers:

{
"Authorization": "mytoken"
}

Body:

{
    "service": "functionName",
    "image": "<registry_ip_address>/functions/functionName:<version>",
    "envProcess": "/.../myprocess",
    "registryAuth": <base64 token obtained from 'user:password'>,
    "secrets": [
        "mysecret"
    ]
}

I confirm that parameters are all correct and I receive this error:

"unable to pull image <registry_ip_address>/functions/functionName:: cannot pull: failed to resolve reference "<registry_ip_address>/functions/functionName:": no scope specified for token auth challenge"

The registry is working well because if I try to download the image in a classic way with docker, I'm able to pull the image.

Thank you in advance!

gcapi
  • 11
  • 4

1 Answers1

7

For faasd you have to make a credential file.

Your normal ~/.docker/config.json needs to be copied to /var/lib/faasd/.docker/config.json.

https://github.com/openfaas/faasd#a-note-on-private-repos--registries

A note on private repos / registries

To use private image repos, ~/.docker/config.json needs to be copied to /var/lib/faasd/.docker/config.json.

If you'd like to set up your own private registry, see this tutorial.

Beware that running docker login on MacOS and Windows may create an empty file with your credentials stored in the system helper.

Alternatively, use you can use the registry-login command from the OpenFaaS Cloud bootstrap tool (ofc-bootstrap):

curl -sLSf https://raw.githubusercontent.com/openfaas-incubator/ofc-bootstrap/master/get.sh | sudo sh

ofc-bootstrap registry-login --username <your-registry-username> --password-stdin
# (then enter your password and hit return)

The file will be created in ./credentials/

Shrout1
  • 2,497
  • 4
  • 42
  • 65
Thom Hubers
  • 172
  • 1
  • 11
  • Thank you! Thant helped me a lot :-) Looks like your provided link does not contain the information anymore. – Klaus Jul 26 '21 at 09:14
  • @Klaus I added the content from the original document so that it will stay on stack into the future. Now if I can just figure this out too... – Shrout1 Aug 11 '21 at 19:27