Add a registry via the API?

I am trying to automate this part of the Rancher setup and was wondering if it is possible to create/configure a Docker registry via the API?

The UI is completely client side, everything can be done through the API. http://docs.rancher.com/rancher/v1.0/en/api/api-resources/registry/

Ah yes that is exactly what I was looking for. Thank you sir!

So I am able to create a registry

curl -u “${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}”
-X POST
-H ‘Accept: application/json’
-H ‘Content-Type: application/json’
-d ‘{“name”:“Test”, “serverAddress”:“index.docker.io”}’
http://192.168.33.11:8080/v1/projects/1a5/registries

It shows up in my list of registries. But I can’t figure out how configure Dockerhub credentials? Would that be another API call? I apologize, I’m not very good with API’s.

I think I got it. It must be this - http://docs.rancher.com/rancher/v1.0/en/api/api-resources/registryCredential/.

1 Like