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

Can´t connect to Private Docker Registry #5286

Open
ItaloPalma opened this issue Apr 28, 2022 · 5 comments
Open

Can´t connect to Private Docker Registry #5286

ItaloPalma opened this issue Apr 28, 2022 · 5 comments
Labels
resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. type/question

Comments

@ItaloPalma
Copy link

What´s the actual solution to solve this problem? I have seen the issue being discussed in many threads but couldn´t figure out how to solve the authentication problem. Could someone explain how to fix this?

@kiview
Copy link
Member

kiview commented Apr 28, 2022

Please share information about your setup and the error logs.

@kiview kiview added type/question resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. labels Apr 28, 2022
@ItaloPalma
Copy link
Author

Hi! Thanks for helping me. I will give some infos that I think that can be important to help.

Application:
Spring Boot 2.6.6
docker java api 3.2.12
Test containers and Junit-Jupiter 1.16.3

Docker Desktop 3.5.2

The pull from the command line is ok:

C:\Users\diitalo>docker pull docker-devel.depdes.artifactory.prod.cloud.ihf/localstack/localstack
Using default tag: latest
latest: Pulling from localstack/localstack
f003217c5aae: Already exists
380a73b6bb26: Already exists
.
.
.
Status: Downloaded newer image for docker-devel.depdes.artifactory.prod.cloud.ihf/localstack/localstack:latest
docker-devel.depdes.artifactory.prod.cloud.ihf/localstack/localstack:latest

What I am trying to do:

@container
public static LocalStackContainer containerAWS = new LocalStackContainer(DockerImageName.parse("docker-devel.depdes.artifactory.prod.cloud.ihf/localstack/localstack").asCompatibleSubstituteFor("localstack/localstack"))
.withServices(LocalStackContainer.Service.SQS);

The trace:

com.github.dockerjava.api.exception.DockerClientException: Could not pull image: unauthorized: authentication required

at com.github.dockerjava.api.command.PullImageResultCallback.checkDockerClientPullSuccessful(PullImageResultCallback.java:97)
at com.github.dockerjava.api.command.PullImageResultCallback.throwFirstError(PullImageResultCallback.java:112)
at com.github.dockerjava.api.async.ResultCallbackTemplate.awaitCompletion(ResultCallbackTemplate.java:93)
at org.testcontainers.images.TimeLimitedLoggedPullImageResultCallback.awaitCompletion(TimeLimitedLoggedPullImageResultCallback.java:52)
at org.testcontainers.DockerClientFactory.checkAndPullImage(DockerClientFactory.java:356)
at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:99)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:219)
at org.testcontainers.DockerClientFactory$1.getDockerClient(DockerClientFactory.java:101)
at com.github.dockerjava.api.DockerClientDelegate.authConfig(DockerClientDelegate.java:107)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:316)
at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.start(TestcontainersExtension.java:242)
at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.access$200(TestcontainersExtension.java:229)
at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$null$1(TestcontainersExtension.java:59)
at org.junit.jupiter.engine.execution.ExtensionValuesStore.lambda$getOrComputeIfAbsent$4(ExtensionValuesStore.java:86)
at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.computeValue(ExtensionValuesStore.java:223)
at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.get(ExtensionValuesStore.java:211)
at org.junit.jupiter.engine.execution.ExtensionValuesStore$StoredValue.evaluate(ExtensionValuesStore.java:191)
at org.junit.jupiter.engine.execution.ExtensionValuesStore$StoredValue.access$100(ExtensionValuesStore.java:171)
at org.junit.jupiter.engine.execution.ExtensionValuesStore.getOrComputeIfAbsent(ExtensionValuesStore.java:89)
at org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:53)
at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$beforeAll$2(TestcontainersExtension.java:59)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.testcontainers.junit.jupiter.TestcontainersExtension.beforeAll(TestcontainersExtension.java:59)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$10(ClassBasedTestDescriptor.java:381)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:381)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:205)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:80)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

My docker config(masked some infos)

{
"auths": {
"docker-devel.depdes.artifactory.prod.cloud.ihf": {
"auth": "XXXX",
"email": "XXXX"
},
"docker-virtual.appdes.artifactory.prod.cloud.ihf": {
"auth": "XXXX",
"email": "XXXX"
}
},
"credsStore": "desktop",
"insecure-registries": [
"docker-remotes.artifactory.prod.aws.cloud.ihf"
],
"proxies": {
"default": {
"httpProxy": "http://example1:8080",
"httpsProxy": "http://example2:8443",
"noProxy": "*.cloud.ihf"
}
},
"stackOrchestrator": "swarm"
}

@kiview
Copy link
Member

kiview commented Apr 28, 2022

Might be related to this issue, although you are not pulling the image from Docker Hub:
#5121

Can you try a Docker login including the protocol?

docker login https://docker-devel.depdes.artifactory.prod.cloud.ihf

@ItaloPalma
Copy link
Author

Yes this happens succesful!

docker login https://docker-devel.depdes.artifactory.prod.cloud.ihf
Authenticating with existing credentials...
Login Succeeded

The beggining of the execution:

{"timestamp":"28/04/2022 13:27:44.835","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Loaded org.testcontainers.dockerclient.NpipeSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first"}
{"timestamp":"28/04/2022 13:27:45.608","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Found Docker environment with local Npipe socket (npipe:////./pipe/docker_engine)"}
{"timestamp":"28/04/2022 13:27:45.623","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Docker host IP address is localhost"}
{"timestamp":"28/04/2022 13:27:45.672","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Connected to docker: \n Server Version: 20.10.7\n API Version: 1.41\n Operating System: Docker Desktop\n Total Memory: 25148 MB"}
{"timestamp":"28/04/2022 13:27:45.679","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')"}
{"timestamp":"28/04/2022 13:27:46.538","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Credential helper/store (docker-credential-desktop) does not have credentials for index.docker.io"}
{"timestamp":"28/04/2022 13:27:50.172","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Starting to pull image"}
{"timestamp":"28/04/2022 13:27:50.201","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Pulling image layers: 0 pending, 0 downloaded, 0 extracted, (0 bytes/0 bytes)"}
{"timestamp":"28/04/2022 13:27:56.982","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Starting to pull image"}
{"timestamp":"28/04/2022 13:27:56.983","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Pulling image layers: 0 pending, 0 downloaded, 0 extracted, (0 bytes/0 bytes)"}
{"timestamp":"28/04/2022 13:28:00.274","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Neither @ContextConfiguration nor @ContextHierarchy found for test class [br.com.itau.liberacaocredito.application.LiberacaoCreditoCorrentistaTest], using SpringBootContextLoader"}
{"timestamp":"28/04/2022 13:28:00.280","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Could not detect default resource locations for test class [br.com.itau.liberacaocredito.application.LiberacaoCreditoCorrentistaTest]: no resource found for suffixes {-context.xml, Context.groovy}."}
{"timestamp":"28/04/2022 13:28:00.280","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Could not detect default configuration classes for test class [br.com.itau.liberacaocredito.application.LiberacaoCreditoCorrentistaTest]: LiberacaoCreditoCorrentistaTest does not declare any static, non-private, non-final, nested classes annotated with @configuration."}
{"timestamp":"28/04/2022 13:28:00.418","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Found @SpringBootConfiguration br.com.itau.liberacaocredito.LiberacaoCreditoApplication for test class br.com.itau.liberacaocredito.application.LiberacaoCreditoCorrentistaTest"}
{"timestamp":"28/04/2022 13:28:00.567","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]"}
{"timestamp":"28/04/2022 13:28:00.589","app":"emprestimospessoafísica-liberacaocredito","level":"INFO","message":"Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@b606cb6, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@2a3194c6, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@2819c460, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@30364216, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@38bb9d7a, org.springframework.test.context.support.DirtiesContextTestExecutionListener@1e8ab90f, org.springframework.test.context.transaction.TransactionalTestExecutionListener@78d6447a, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@7a729f84, org.springframework.test.context.event.EventPublishingTestExecutionListener@1e469dfd, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@554f0dfb, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@1f7076bc, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@71904469, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@5b9396d3, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@761e788f, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@6a472566]"}

Test ignored.

@ItaloPalma
Copy link
Author

I´ll also read the issue you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. type/question
Projects
None yet
Development

No branches or pull requests

2 participants