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

Authentication fails on docker hub #591

Open
skenchjyg opened this issue Dec 27, 2023 · 0 comments
Open

Authentication fails on docker hub #591

skenchjyg opened this issue Dec 27, 2023 · 0 comments

Comments

@skenchjyg
Copy link

I created the following file

terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
}
}

provider "docker" {
registry_auth {
address = "https://index.docker.io/v1/"
username = "username"
password = "password"
}
}

resource "docker_image" "application" {
name = "username/application:latest"
build {
context = "."
dockerfile = "Dockerfile"
}
keep_locally = false
}

resource "docker_registry_image" "application" {
name = "docker_image.application.name"
}

When I try to run it with the "terraform apply" command

I am get error

│ Error: resourceDockerRegistryImageCreate: Unable to get authConfig for registry: no auth config found for registry registry-1.docker.io in auth configs: map[string]types.AuthConfig{"index.docker.io":types.AuthConfig{Username:"my_username", Password:"my_password-", Auth:"", Email:"", ServerAddress:"https://index.docker.io/v1/", IdentityToken:"", RegistryToken:""}}

I check that the data is correct like this:
docker login
Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one.
You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/

Username: my_username
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

Please tell me what am I doing wrong? I just want to push the image to the docker hub registry.

I changed the password so that there were no special characters such as @ | and so on in the password, I only have letters and numbers

I tried using different versions, I tried to ask chatgpt for the error, but I didn't find an answer. The config appears to be correct.

Thanks for any help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant