Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image not found when reading a public image from docker hub #229

Closed
adam-lebon opened this issue Jun 22, 2021 · 8 comments · Fixed by #230
Closed

Image not found when reading a public image from docker hub #229

adam-lebon opened this issue Jun 22, 2021 · 8 comments · Fixed by #230
Labels
bug Something isn't working d/registry_image
Milestone

Comments

@adam-lebon
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and docker Provider) Version

Terraform version :

Terraform v1.0.0
on darwin_amd64
+ provider registry.terraform.io/kreuzwerker/docker v2.12.2

Docker for Mac version :

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  compose: Docker Compose (Docker Inc., 2.0.0-beta.1)
  scan: Docker Scan (Docker Inc., v0.8.0)

 Server Version: 20.10.6

Affected Resource(s)

  • docker_registry_image

Terraform Configuration Files

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

output "sha" {
	value = data.docker_registry_image.ubuntu.sha256_digest
}

Debug Output

https://gist.github.com/adam-lebon/27771eb13b0b4966b354e9a6f7d2600a

Expected Behaviour

The request to the docker registry should succeed

Actual Behaviour

The provider cannot read the manifest of the requested image.

The docker hub returns a 404 not found error error. Even if it is a public image.

In the first place, I thought the issue was from the docker hub. But I can't find anything related to the docker hub.

Steps to Reproduce

  1. Create a simple configuration which use a data docker_registry_image
  2. terraform plan

Important Factoids

Nothing special :

  • Tested from different IP
  • Tested from multiple OS (Docker for Mac + Docker native on ubuntu)
  • Tested manually with curl curl -vL https://registry.hub.docker.com/v2/library/ubuntu/manifest/latest
@eranreshef
Copy link

I'm encountering something similar since last night when trying to access registry.hub.docker.com/v2/

@riisi
Copy link

riisi commented Jun 22, 2021

I just had this happen this morning and was about to raise an issue. I'm wondering if Docker have deprecated registry.hub.docker.com.

I updated to index.docker.io with the following configuration and got things working.

provider "docker" {
  registry_auth {
    address  = "index.docker.io"
    username = local.dockerhub_username
    password = local.dockerhub_password
  }
}

data "docker_registry_image" "optic" {
  name = "index.docker.io/myorg/myimage:1.0.0"
}

@adam-lebon
Copy link
Contributor Author

You are right, I will put index.docker.io in front of all my images as a temporary fix.

data "docker_registry_image" "ubuntu" {
	name = "index.docker.io/library/ubuntu:latest"
}

output "sha" {
	value = data.docker_registry_image.ubuntu.sha256_digest
}

@adam-lebon
Copy link
Contributor Author

adam-lebon commented Jun 22, 2021

I am looking for some official confirmation that the new endpoint is index.docker.io before opening a MR

@eranreshef
Copy link

I am looking for some official confirmation that the new endpoint is index.docker.io before opening a MR

It's very difficult to find such confirmation, I couldn't find any hostname that actually works in the official documentation.

@adam-lebon
Copy link
Contributor Author

I am looking for some official confirmation that the new endpoint is index.docker.io before opening a MR

It's very difficult to find such confirmation, I couldn't find any hostname that actually works in the official documentation.

During the past hour, I just realised that so many project are fixing their repos to remove this old URL (doing a global search for issues containing "registry.hub.docker.com" gives a taste of the impact).

I noticed that some people are working with:

  • registry.hub.docker.com
  • registry-1.docker.io
  • index.docker.io

From this comment docker/hub-feedback#2113 (comment)_ , we can read:

[...] but I don't think we provided an official deprecation notice

He also recommend to use registry-1.docker.io as registry, but I think we should use the same registry used by our docker clients: index.docker.io

@eranreshef
Copy link

I went ahead with index.docker.io for my project.
I also tested all 3 and registry.hub.docker.com didn't work for me (returned a 404).

@tomalok
Copy link

tomalok commented Jun 22, 2021

Per docker/hub-feedback#2113 (comment) registry.hub.docker.com should be working again (they rolled back some changes), and they are investigating what the right value to use going forward is.

@mavogel mavogel added this to the v2.14.0 milestone Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working d/registry_image
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants