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

Cannot start testcontainer if wincred store is used #392

Closed
beihaifeiwu opened this issue Jul 3, 2017 · 17 comments
Closed

Cannot start testcontainer if wincred store is used #392

beihaifeiwu opened this issue Jul 3, 2017 · 17 comments

Comments

@beihaifeiwu
Copy link

java.lang.ExceptionInInitializerError
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
	at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:142)
	at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1088)
	at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
	at java.lang.reflect.Field.get(Field.java:393)
	at org.junit.runners.model.FrameworkField.get(FrameworkField.java:73)
	at org.junit.runners.model.TestClass.getAnnotatedFieldValues(TestClass.java:230)
	at org.junit.runners.ParentRunner.classRules(ParentRunner.java:255)
	at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:244)
	at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:194)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:362)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:189)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: com.github.dockerjava.api.exception.DockerClientException: Failed to parse dockerCfgFile
	at com.github.dockerjava.core.DefaultDockerClientConfig.effectiveAuthConfig(DefaultDockerClientConfig.java:268)
	at com.github.dockerjava.core.DockerClientImpl.pullImageCmd(DockerClientImpl.java:215)
	at org.testcontainers.dockerclient.AuditLoggingDockerClient.pullImageCmd(AuditLoggingDockerClient.java:22)
	at org.testcontainers.DockerClientFactory.checkAndPullImage(DockerClientFactory.java:202)
	at org.testcontainers.DockerClientFactory.runInsideDocker(DockerClientFactory.java:222)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:117)
	at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:110)
	at org.testcontainers.containers.FixedHostPortGenericContainer.<init>(FixedHostPortGenericContainer.java:16)
	at com.palmaplus.euphoria.data.ElasticsearchRepositoryTest.<clinit>(ElasticsearchRepositoryTest.java:38)
	... 18 more
Caused by: java.io.IOException: The Auth Config file is empty
	at com.github.dockerjava.core.AuthConfigFile.loadConfig(AuthConfigFile.java:141)
	at com.github.dockerjava.core.DefaultDockerClientConfig.effectiveAuthConfig(DefaultDockerClientConfig.java:266)
	... 26 more
@wlsc
Copy link
Contributor

wlsc commented Jul 4, 2017

I had same issue but not with the Test Containers library but the Docker itself. Reinstalled it (with deleting .docker folder) and it helped.

@kiview
Copy link
Member

kiview commented Jul 6, 2017

The error message sounds like a problem with your config.json file (which resides inside the .docker/ registry, so @wlsc solution makes sense).

@beihaifeiwu
Copy link
Author

Hi @kiview @wlsc , thinks for your reply , I have tried delete .docker folder and reinstall, but the error still exists. Now I cannot run any test due to this problem :( .

@kiview
Copy link
Member

kiview commented Jul 6, 2017

Are you trying to use a private image? Did you do a docker login on the host before?

@beihaifeiwu
Copy link
Author

No, I just use the image from the docker hub. Yes I have login on the host before, but that did not help either.

@kiview
Copy link
Member

kiview commented Jul 6, 2017

What's the content of your config.json file? Does it exist? (don't paste the content if it contains your credentials ;) )

@beihaifeiwu
Copy link
Author

Yes, it exists!

{"credsStore":"wincred","auths":{"https://index.docker.io/v1/":{}}}

@kiview
Copy link
Member

kiview commented Jul 6, 2017

Oh I see, you are on windows? It might be a problem with docker-java and a recent Docker for Windows version. I'll try to test it on windows once I have the time.

@beihaifeiwu
Copy link
Author

Yes, my system is Windows 10, thanks for you attention

@bsideup
Copy link
Member

bsideup commented Jul 6, 2017

Please also try #393 with updated docker-java (with Jitpack)

@beihaifeiwu
Copy link
Author

@bsideup , It didn't work either :( .

@jeacott1
Copy link

jeacott1 commented Mar 8, 2018

i had the same issue, with .docker/config.json containing

{"credsStore":"wincred"}

I renamed the config file and testContainers almost worked.
pulls the image but gets stuck launching.

org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32773] should be listening)
	at org.testcontainers.containers.wait.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:49) ~[testcontainers-1.6.0.jar:na]
	at org.testcontainers.containers.GenericContainer$AbstractWaitStrategy.waitUntilReady(GenericContainer.java:1065) ~[testcontainers-1.6.0.jar:na]
	at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:521) [testcontainers-1.6.0.jar:na]
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:243) [testcontainers-1.6.0.jar:na]
	at org.testcontainers.containers.GenericContainer.lambda$start$0(GenericContainer.java:194) [testcontainers-1.6.0.jar:na]

@kiview
Copy link
Member

kiview commented Mar 14, 2018

@jeacott1 Which image were you testing? Do you have log output from the preflight checks, did they succeed?

@jeacott1
Copy link

@kiview initially the testcontainers-java-module-elasticsearch, and now the postgres module. haven't had any issues since removing the config file. and I just tried it, the postgres module at least still works now I've restored the file.
fwiw - I cant recall the order of things but at some point I had to accept a security permission dialog accepting docker be allowed access to the local drive.

@kiview
Copy link
Member

kiview commented Mar 15, 2018

@jeacott1 Thanks for all your feedback (spread over different issues 😉), I'll try to confirm, that this has to do with the wincred credStore in Docker for Windows.

@kiview kiview changed the title Cannot start test container after Docker upgrade to 17.06.0-ce Cannot start testcontainer if wincred store is used Mar 15, 2018
@stale
Copy link

stale bot commented Oct 28, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.

@stale stale bot added the stale label Oct 28, 2018
@rnorth
Copy link
Member

rnorth commented Oct 28, 2018

We added support for credential helpers recently, with Windows support in 1.9.0.

As such, this should work now! Please feel free to reopen if there are other issues with this feature.

@rnorth rnorth closed this as completed Oct 28, 2018
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