Nomad Golang SDK - Docker Driver Private Registry Auth


I am using the official Golang Client SDK to interact with the Nomad API. This is working great thus far. I now have a need to pass credentials for authenticating a Nomad job with private Docker registries, namely, GitHub Container Registry. From the official documentation, I see that this is possible via the auth object. My question is: how would I accomplish this via the Golang SDK? I tried going through the API codebase but wasn’t able to find an answer. Any help would be greatly appreciated. In the interim, I’ll keep searching.

~ TP

Hi @tarpan.pathak, when specifying the config block of a task, you set those key-value pairs in nomad/tasks.go at main · hashicorp/nomad · GitHub

These are driver-specific, which is why the API exposes them as a map[string]interface{} instead of pre-defined fields. The ability to configure tasks differs from driver to driver.

Hi @seth.hoenig, thanks for the prompt response. I’ll try this out. Thanks again.