You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "lmorandini (via GitHub)" <gi...@apache.org> on 2024/01/04 02:05:47 UTC

[I] Unable to authenticate with Docker Hub API v2 [camel-k]

lmorandini opened a new issue, #5017:
URL: https://github.com/apache/camel-k/issues/5017

   ### What happened?
   
   Trying to run a sample integration fails with: 'unexpected status code 401 Unauthorized `.
           
   The workaround is to create a secret that has  `https://index.docker.io/v1/` as the docker server 
   
   I tried to set that value during the Camel-K installation to avoid changing all secrets, but that resulted in an error during the sample integration build:
   `Build kit-cmavqirma4hs738o9el0 failed: Get \"https://https/v2/\": dial tcp: lookup https on 10.254.0.10:53: no such host/).`
   
   
   
   ### Steps to reproduce
   
   1. Instal Camel-K specifying the registry as `--registry=docker.io` in `kamel install`;
   2. Create a secret with `--docker-server=docker.io` with the credentials of a Docker Hub user;
   3. Run  a sample integration:
   ```
   curl -XGET\
            "https://raw.githubusercontent.com/apache/camel-k-examples/main/generic-examples/languages/simple.js"\
            -o /tmp/simple.js
       kamel run \
         /tmp/simple.js \
         --name=sample \
         --dev
   ```
   
   
   ### Relevant log output
   
   ```shell
   "level":"info","ts":"2024-01-04T01:52:15Z","logger":"camel-k.controller.build","msg":"Build duration 17.776347732s","request-namespace":"api","request-name":"sample","build-attempt":1,"build-result":"Failed","build-duration":17.776347732,"api-version":"camel.apache.org/v1","kind":"Build","ns":"api","name":"kit-cmb0u7omgm9c738e10j0"}
   {"level":"error","ts":"2024-01-04T01:52:15Z","logger":"camel-k.controller.build","msg":"Build kit-cmb0u7omgm9c738e10j0 failed: HEAD https://index.docker.io/v2/lmorandini/camel-k-kit-cmb0u7omgm9c738e10j0/manifests/11426772: unexpected status code 401 Unauthorized (HEAD responses have no body, use GET for details)","request-namespace":"api","request-name":"kit-cmb0u7omgm9c738e10j0","api-version":"camel.apache.org/v1","kind":"Build","ns":"api","name":"kit-cmb0u7omgm9c738e10j0","stacktrace":"github.com/apache/camel-k/v2/pkg/util/log.Logger.Errorf\n\tgithub.com/apache/camel-k/v2/pkg/util/log/log.go:60\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).updateBuildStatus\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:216\ngithub.com/apache/camel-k/v2/pkg/controller/build.(*monitorRoutineAction).runBuild\n\tgithub.com/apache/camel-k/v2/pkg/controller/build/monitor_routine.go:200"}
   {"level":"info","ts":"2024-01-04T01:52:15Z","logger":"camel-k.controller.build","msg":"State transition","request-namespace":"api","request-name":"kit-cmb0u7omgm9c738e10j0","api-version":"camel.apache.org/v1","kind":"Build","ns":"api","name":"kit-cmb0u7omgm9c738e10j0","phase-from":"Running","phase-to":"Failed"}
   {"level":"info","ts":"2024-01-04T01:52:15Z","logger":"camel-k.controller.build","msg":"Recovery attempt (2/5)","request-namespace":"api","request-name":"kit-cmb0u7omgm9c738e10j0","api-version":"camel.apache.org/v1","kind":"Build","ns":"api","name":"kit-cmb0u7omgm9c738e10j0"}
   ```
   ```
   
   
   ### Camel K version
   
   2.1.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1876678445

   I think the best way to solve this is to leverage directly the [creation of the secret via `kubectl`](https://camel.apache.org/camel-k/2.1.x/installation/registry/dockerhub.html#_alternative_methods) and later using it in the installation procedure. In this way you can specify the server on your own via `--docker-server` parameter as we discussed in the zulip chat thread [1].
   
   [1] https://camel.zulipchat.com/#narrow/stream/257299-camel-k/topic/Docker.20Hub.20authorisation.20error


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1886897125

   Yes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1884990395

   @lmorandini There is a limitation from spectrum that only allows `https://index.docker.io/v1/` as server auth for the `docker.io` reference to the docker hub registry. The only way I found that could work with spectrum is the default DNS name for the Docker Hub registry: `registry-1.docker.io`. That is also the DNS name used by default by the Jib publish strategy (the alternative to spectrum) push the new images. 
   
   With any other registry declared, the API used is V2 by default, so I am not sure it is really using V1 API by default even with  `https://index.docker.io/v1/` as server auth. But to be honest I can't be sure. The references online on docker hub registry URLs are not clear and there has been changes in them in the previous year. The result is that there is legacy code in libraries kept to avoid breaking old code.
   
   I will update Camel K documentation on the docker hub registry.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "lmorandini (via GitHub)" <gi...@apache.org>.
lmorandini commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1876699770

   You sure can... still, it is a bit confusing to install with a v2 registry and then have to use a v1 registry.
   By the way, is Docker API v2 supported at all?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1878273121

   > No, it is not working correctly when the secret is created with the `v2` endpoint (i.e. `--docker-server=docker.io`).
   
   Okey, then we need to find out why. I'm moving this into bug label and we'll figure it out what's going on. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1886800565

   @gansheer does #5045 also close this one?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1878284068

   @squakez I can look into it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1876705300

   > You sure can... still, it is a bit confusing to install with a v2 registry and then have to use a v1 registry. By the way, is Docker API v2 supported at all?
   
   No, what I meant is to create the secret with the `v2` endpoint and use it ootb. Is it working correctly in that case? In theory, the operator is agnostic of the registry API used.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "lmorandini (via GitHub)" <gi...@apache.org>.
lmorandini commented on issue #5017:
URL: https://github.com/apache/camel-k/issues/5017#issuecomment-1877871092

   No, it is not working correctly when the secret is created with the `v2` endpoint (i.e. `--docker-server=docker.io`).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Unable to authenticate with Docker Hub API v2 [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez closed issue #5017: Unable to authenticate with Docker Hub API v2
URL: https://github.com/apache/camel-k/issues/5017


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org