Docker login to a private registry with custom docker config fails for "unexpected keys auths"

I am having an issue trying to log in to a private docker repo.
The following configurations are set on a client node.

nomad config:

plugin "docker" {
  config {
    volumes {
      enabled = true
    }
    auth {
      config = "/etc/nomad/docker-auth.json"
    }
  }
}

/etc/nomad/docker-auth.json

{
  "auths": {
    "my.private.repo": {
      "auth": "`echo -n 'user:pwd' | base64 -w0`"
    }
  }
}

nomad logs:

==> Error loading configuration from /etc/nomad: Error loading /etc/nomad/docker-auth.json: unexpected keys auths

What am I missing?

Thanks!

I think, the Nomad agent is trying to load the .json file as a Nomad config file.

Nomad support .hcl and .json as configuration files.
ref: Agent Configuration | Nomad by HashiCorp

I would suggest you place the Docker’s json file in a different directory.

Also, a little off topic, but sort-of related … @blake @lgfa29

this is the type of confusion why I was arguing against putting the SystemD .env files along with the agent’s config files, i.e. “not to mix different types of files”

2 Likes