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

Pre-resolve LazyDockerClient from GenericContainer#start() #3530

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

bsideup
Copy link
Member

@bsideup bsideup commented Nov 24, 2020

Before:

Exception in thread "main" org.testcontainers.containers.ContainerLaunchException: Container startup failed
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
	at org.testcontainers.DaemonTest.main(DaemonTest.java:27)
Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=alpine:3.5, imagePullPolicy=DefaultPullPolicy())
	at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1280)
	at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:614)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:319)
	... 2 more
Caused by: java.lang.IllegalStateException: Could not connect to Ryuk at localhost:32779
	at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:173)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:203)
	at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
	at org.testcontainers.LazyDockerClient.listImagesCmd(LazyDockerClient.java:12)
	at org.testcontainers.images.LocalImagesCache.maybeInitCache(LocalImagesCache.java:68)
	at org.testcontainers.images.LocalImagesCache.get(LocalImagesCache.java:32)
	at org.testcontainers.images.AbstractImagePullPolicy.shouldPull(AbstractImagePullPolicy.java:18)
	at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:66)
	at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:27)
	at org.testcontainers.utility.LazyFuture.getResolvedValue(LazyFuture.java:17)
	at org.testcontainers.utility.LazyFuture.get(LazyFuture.java:39)
	at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1278)
	... 4 more

(stacktrace starts from getDockerImageName, misleading Can't get Docker image: RemoteDockerImage(imageName=alpine:3.5, imagePullPolicy=DefaultPullPolicy()) when in fact Ryuk is the reason)

After:

Exception in thread "main" java.lang.IllegalStateException: Could not connect to Ryuk at localhost:32780
	at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:173)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:203)
	at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
	at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:309)
	at org.testcontainers.DaemonTest.main(DaemonTest.java:27)

Short stacktrace, stacktrace starts at GenericContainer.start

@bsideup bsideup added this to the 1.15.1 milestone Nov 24, 2020
@bsideup bsideup merged commit dc0588e into master Dec 2, 2020
@delete-merged-branch delete-merged-branch bot deleted the pre_resolve_lazy_client branch December 2, 2020 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants