testcontainers / testcontainers/testcontainers-java

Since Docker 20.10.6: Error starting userland proxy: listen tcp6

Open
#4,126 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

With Docker 20.10.6 docker is failing when ipv6 is disabled.
There seems to be a workaround by explicitly specifying the network interface. For example:

$ docker run --rm -d -p 0.0.0.0:8080:80 nginx:latest

Is there a possibility to specify the network inteface using the GenericContainer? I cannot find anything in the API. Any workaround is appreciated, since all docker tests are failing due to this issue and it is no possible to enable ipv6 on our CI environment.

See also: docker ipv6 disabled issue

The following is the actual error that occurs during running a testcontainer;

``
com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"driver failed programming external connectivity on endpoint testcontainers-ryuk-dad37a3e-2c74-4bff-bd37-0f0051d3b934 (1ef25a1f64f846100fdc06fab4ff91322026ddf8bc70a312049358348d4a94fb): Error starting userland proxy: listen tcp6 [::]:49212: socket: address family not supported by protocol"}

at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:102)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:31)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:13)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
at org.testcontainers.shaded.com.github.dockerjava.core.command.StartContainerCmdImpl.exec(StartContainerCmdImpl.java:43)
at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:110)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:205)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
at org.testcontainers.containers.GenericContainer.starting(GenericContainer.java:1029)
at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29)

``

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing GenericContainer.start() and ResourceReaper.start() from the stack trace, then inspect how container port bindings are passed to Docker. Reproduce the failure with IPv6 disabled and compare it with the documented 0.0.0.0 workaround. Done means Docker tests can start successfully in that CI environment with an explicit network interface option.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
devops, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.