0

How would I provide docker hub credentials to a private image in the following example?

data "docker_registry_image" "ubuntu" {
  name = "ubuntu:latest"
}

resource "docker_image" "ubuntu" {
  name          = "${data.docker_registry_image.ubuntu.name}"
  pull_triggers = ["${data.docker_registry_image.ubuntu.sha256_digest}"]
}

1 Answer 1

1

Docker registry credentials is seting up in provider configuration.

provider "docker" {
  registry_auth {
    address = "quay.io:8181"
    username = "someuser"
    password = "somepass"
  } 
}

Also possible to set env variables DOCKER_REGISTRY_USER and DOCKER_REGISTRY_PASS

1
  • Do not hardcode credentials, use variables instead.
    – Kyslik
    Commented Mar 11, 2019 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.