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

Couldn't login to docker hub. Error - login attempt to https://hub.docker.com/v2/ failed with status: 404 Not Found #34872

Closed
rajcspsg opened this issue Sep 17, 2017 · 12 comments

Comments

@rajcspsg
Copy link

Description
couldn't able to login to docker hub.
I have tested this against Fedora 25/26.
The below command is working fine in Ubuntu 16.04
$ docker login --username abc --password xxx https://hub.docker.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: login attempt to https://hub.docker.com/v2/ failed with status: 404 Not Found

I have follwed the steps in the URL https://docs.docker.com/engine/installation/linux/docker-ce/fedora/#install-using-the-repository to install docker.

I start docker using the below command
$ sudo systemctl start docker

$ docker --version
Docker version 17.09.0-ce-rc1, build ae21824

$ docker-machine --version
docker-machine version 0.12.2, build 9371605

Steps to reproduce the issue:
1.create account in docker-hub https://hub.docker.com/.
2.login into docker hub account using terminal in ubuntu 16.04. This will work as expected.
$ docker login --username abc --password xxx https://hub.docker.com
3.login into docker hub account using terminal in Fedora 25/26.It fails.

Describe the results you received:

$ docker login --username abc --password xxx https://hub.docker.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: login attempt to https://hub.docker.com/v2/ failed with status: 404 Not Found

Describe the results you expected:
login is expected to be succeded

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:      17.09.0-ce-rc1
 API version:  1.31
 Go version:   go1.8.3
 Git commit:   ae21824
 Built:        Wed Sep  6 22:31:42 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce-rc1
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   ae21824
 Built:        Wed Sep  6 22:33:07 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 3
 Running: 0
 Paused: 0
 Stopped: 3
Images: 20
Server Version: 17.09.0-ce-rc1
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.12.9-300.fc26.x86_64
Operating System: Fedora 26 (Twenty Six)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.794GiB
Name: localhost.localdomain
ID: R3ET:HF5C:ILYK:S46A:5OYO:E67Z:GACB:AFJE:5V7G:EY3V:GBMX:IPTB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false


Additional environment details (AWS, VirtualBox, physical, etc.):
physical - Fedora 25/26

@thaJeztah
Copy link
Member

Docker Hub is the default registry, so there's no need to specify the registry (i.e., just docker login --username .... is sufficient).

However, the reason you're getting this error, is because hub.docker.com is the domain of the Docker Hub website, not the registry backing Docker Hub; the registry is located at index.docker.io, (e.g. docker login index.docker.io).

Closing because this is not a bug, but feel free to continue the conversation

@rajcspsg
Copy link
Author

rajcspsg commented Sep 19, 2017

hi @thaJeztah
Below is the error I am getting when I don't specify the docker registry.

$ docker login --username abc --password xyz

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

Could you please check at your end if this is the case?

@thaJeztah
Copy link
Member

That last message looks correct if the username or password is incorrect

@rajcspsg
Copy link
Author

@thaJeztah I've verified the username and password and it is correct but still I see the error in Fedora 25 or 26 but login is successful in Ubuntu 16.04.

Can you please check in any fedora 25/26 machine whether it works fine as expected?

@rajcspsg
Copy link
Author

@thaJeztah did you get the chance to verify the steps on Fedora 25/26?

@thaJeztah
Copy link
Member

Looks to work for me;

$ docker login
Login with your Docker ID 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.
Username: thajeztah
Password:
Login Succeeded

$ docker pull thajeztah/private-test-image
Using default tag: latest
latest: Pulling from thajeztah/private-test-image
6c123565ed5e: Pull complete
8380043c1909: Pull complete
bc193245541a: Pull complete
f6058f41c33e: Pull complete
Digest: sha256:26d2327aea9a087305fae56939a8a4072304c7f6b401c111221f16278c3a0efd
Status: Downloaded newer image for thajeztah/private-test-image:latest
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:17 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:43:42 2017
 OS/Arch:      linux/amd64
 Experimental: false
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.11.8-300.fc26.x86_64
Operating System: Fedora 26 (Cloud Edition)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: fedora-2gb-ams3-01.localdomain
ID: 5TFT:A34Z:3BKZ:CWV5:XVLL:DMBA:C7MR:TMFR:VCSF:XEAB:3CEJ:VHY2
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: thajeztah
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Things to try:

  • if your username has an uppercase letter, use all lowercase (the docker hub login page automatically transforms to lowercase, but the cli does not)
  • try removing or renaming your ~/.docker/config.json CLI configuration file

@rajcspsg
Copy link
Author

rajcspsg commented Oct 3, 2017

surprisingly my laptop doesn't have ~/.docker/config.json CLI configuration file.

@dhirajbharara
Copy link

Iam also facing the same issue The command docker login jfrog.xxxxx.xxxxxx returns this error
Error response from daemon: login attempt to https://jfrog.xxxx.xxxxx/v2/ failed with status: 404 Not Found

"It concatenates v2 to the URL I am trying to access". The URL is valid and repository used to store the dockers is jfrog.

THe log file of docker at /var/log/upstart/docker.log reads
time="2017-10-06T19:43:17.892166362+05:30" level=info msg="Error logging in to v2 endpoint, trying next endpoint: login attempt to https://jfrog.xxxx.xxxx/v2/ failed with status: 404 Not Found"

@rajcspsg
Copy link
Author

rajcspsg commented Nov 1, 2017

@thaJeztah - I think we shouldn't close this issue since others facing the same issue. Could you please check why different systems login into different URLs?

@thaJeztah
Copy link
Member

If a 404 is returned by the registry, that means the registry is not conforming to the registry V2 specification; https://github.com/docker/distribution/blob/master/docs/spec/api.md#api-version-check

API Version Check

A minimal endpoint, mounted at /v2/ will provide version support information
based on its response statuses. The request format is as follows:

GET /v2/

If a 200 OK response is returned, the registry implements the V2(.1)
registry API and the client may proceed safely with other V2 operations.
Optionally, the response may contain information about the supported paths in
the response body. The client should be prepared to ignore this data.

If a 401 Unauthorized response is returned, the client should take action
based on the contents of the "WWW-Authenticate" header and try the endpoint
again. Depending on access control setup, the client may still have to
authenticate against different resources, even if this check succeeds.

If 404 Not Found response status, or other unexpected status, is returned,
the client should proceed with the assumption that the registry does not
implement V2 of the API.

When a 200 OK or 401 Unauthorized response is returned, the
"Docker-Distribution-API-Version" header should be set to "registry/2.0".
Clients may require this header value to determine if the endpoint serves this
API. When this header is omitted, clients may fallback to an older API version.

It's possible the registry only implements V1 (or has not been configured to use the V2 specification, in which case the daemon has to be configured to support legacy registries (using the --disable-legacy-registry=false option on the daemon)

If that doesn't work, I suggest opening a ticket with JFrog / Artifactory

@zhangwei8607
Copy link

The key is to use your id with the usename to login , don't use the registry email address.

@Uceeyjudy
Copy link

docker login index.docker.io

Please if this is your issue how do you solve it, please help

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

No branches or pull requests

6 participants