Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 454
Sarath C Akurathi Avatar asked Aug 26 '20 15:08

Sarath C Akurathi


People also ask

Why is my Artifactory not responding to my API request?

If you do not have appropriate permissions For example, this would occur if the initial Dashboard Artifactory user does not have permissions to run REST-API and build requests. You should create a regular Artifactory admin user in order to use the REST-API and/or handle build requests.

Why is my Artifactory dashboard not working?

3. If you do not have appropriate permissions For example, this would occur if the initial Dashboard Artifactory user does not have permissions to run REST-API and build requests. You should create a regular Artifactory admin user in order to use the REST-API and/or handle build requests.

Why can't my Artifactory handle the REST-API?

For example, this would occur if the initial Dashboard Artifactory user does not have permissions to run REST-API and build requests. You should create a regular Artifactory admin user in order to use the REST-API and/or handle build requests. Please visit Managing Passwords for more details.

Does Docker-Artifactory need the specific Repository present to work?

It needs the specific repository to be present to work. I created a virtual repository called docker-artifactory and then logged in: Sorry, something went wrong. works for me!


1 Answers

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.

like image 83
balonik Avatar answered Sep 28 '22 01:09

balonik