@talios Oh, I saw you say this on the bird the other day?
Just install netcat and see if that gets you a new error :)
@talios Oh, ok
Testcontainers runs a couple of commands from within the container to determine when the intenral port of the container is available: https://github.com/testcontainers/testcontainers-java/blob/5e6dbc791b6184f0de6d1f9d184a78324c1ec945/core/src/main/java/org/testcontainers/containers/wait/internal/InternalCommandPortListeningCheck.java#L29-L38
This is part of the default HostPortWaitStrategy. It might be the case, that the atmoz/sftp:latest does not allow any of those commands to be run.
I have this very simple code for running my integration test: (using Testcontainer artifact version 1.16.2) Note: I have tested whether this port in test is available before running the test case. @
@talios And
First check if port 2222 is free in the machine that is launching the TestContainer.
Second, change you setup of GenericContainer to:
sftpContainer = new GenericContainer<>(DockerImageName.parse("atmoz/sftp:latest")).withExposedPorts(PORT)
.withCommand("foo:pass:::folder")
.withCreateContainerCmdModifier(
cmd -> cmd.withHostConfig(
new HostConfig()
.withPortBindings(new PortBinding(Ports.Binding.bindPort(22), new ExposedPort(PORT)))));
You need to map the exposed port (in your case 2222) into the internal port (22).
This example run on version 1.16.0 of testcontainers.
@SaturniusMons just saw this - looks like this may be a red herring - the 8181 port is unavailable as the service hasnt started (it fails talking/connecting to the other containers before starting to service).
But diving thru the TC code after talking to somekne on their slack helped isolate that and pojnt me in different direction which still atm eludes me