hashicorp / terraform-provider-docker

As part of our introduction to self-service publishing in the Terraform Registry, this copy of the provider has been archived, and ownership has been transferred to active maintainers in the community. Please see the new location on the Terraform Registry: https://registry.terraform.io/providers/kreuzwerker/docker/latest
https://registry.terraform.io/providers/kreuzwerker/docker/latest
Mozilla Public License 2.0
132 stars 92 forks source link

Can't pull docker images when using ssh based host #262

Closed WhoAteDaCake closed 4 years ago

WhoAteDaCake commented 4 years ago

Terraform Version

Terraform v0.12.24

Affected Resource(s)

Terraform Configuration Files

provider "docker" {
  host = var.host

  registry_auth {
    address = "https://index.docker.io/v1/"
    config_file = pathexpand("~/.docker/config.json")
  }
}

resource "docker_image" "graphql" {
  name = "nanowire/jwt-postgraphile-server:1.0.0-beta.13"
}

Debug Output

https://gist.github.com/WhoAteDaCake/4865556a5bae621074385ec929a07c12

P.S Had to take only the bottom part of the logs as they contain my docker credentials

Expected Behavior

Expect the image to be pulled

Actual Behavior

Image should be pulled correctly

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

jbruett commented 4 years ago

@WhoAteDaCake I thought I was having this same issue, i wasn't, turned out to be the image name was wrong (i'm pretty new to docker). In either case, the docs indicate that the registry_auth block is only for targetting v2 of the API. for me the following block worked.

provider docker {
  host = "ssh://user@xxx.xxx.x.xxx"
  registry_auth {
      address = "registry.hub.docker.com"
      username = "user"
      password = "access-token"
  }
}
WhoAteDaCake commented 4 years ago

Using the registry auth + manual username/password worked. Thank you @jbruett