简体   繁体   中英

Artifactory docker registry login failed with 400 bad request

I am trying to login to the docker registry in artifactory. I was able to do it from curl but getting 400 bad request from docker login command. This is an enterprise artifactory so I do not have admin access for checking logs.

CURL

$ curl -I https://<EMAIL>:<TOKEN>@artifactory.myorg.com/api/docker/sample-docker/v2/
HTTP/1.1 200 OK
Date: Tue, 25 Aug 2020 18:41:35 GMT
Content-Type: application/json
Connection: keep-alive
Set-Cookie: X-Oracle-BMC-LBS-Route=7f4f0554bc358efb45fcb4fede9cb5632a7b7b07; Path=/
X-Artifactory-Id: 524cb1f38361d95717ff9ba8b8d5fc805d4547e6
X-Artifactory-Node-Id: node2
Docker-Distribution-Api-Version: registry/2.0

Docker login command

$ docker login artifactory.myorg.com
Username: <EMAIL>
Password:
Error response from daemon: login attempt to https://artifactory.myorg.com/v2/ failed with status: 400 Bad Request

Docker version

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:21:11 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

this depends what is the setup on Artifactory side. There are 3 methods how to setup access to Docker repositories:

  • Repository Path (Direct Access)
  • Port
  • Sub-domain (mostly used as JFrog recommends this one)

You need to ask the Artifactory support team or find in their documentation which method is used. docker login is different based on the method used. Unfortunately, what I can tell, the 'Set Me Up' button for Docker repositories always shows commands for Repository Path method and does not reflect the actual method configured.

For Sub-domain the login and pull/push should look like this:
docker login <REPOSITORY_KEY>.artifactory.myorg.com
docker pull / push <REPOSITORY_KEY>.artifactory.myorg.com/<IMAGE>:<TAG>
so in your example:
docker login sample-docker.artifactory.myorg.com

For Repository Path the login and pull/push should look like this:
docker login artifactory.myorg.com
docker pull / push artifactory.myorg.com/<REPOSITORY_KEY>/<IMAGE>:<TAG>

For Port the login and pull/push should look like this:
docker login artifactory.myorg.com:<REPOSITORY_PORT>
docker pull / push artifactory.myorg.com:<REPOSITORY_PORT>/<IMAGE>:<TAG>

Note: You will also get 400 Bad Request if you try to use non-existing repository.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM