Authentication fails on docker hub
skenchjyg opened this issue · 0 comments
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