1

I'm attempting to run a localstack container as part of a test in a spring boot test.

I setup a new spring boot app using the initializr, however I don't understand why I'm getting the following error when calling start:

com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: not a directory
 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:124)
 at org.testcontainers.shaded.com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:37)
 at org.testcontainers.shaded.com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.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.CreateContainerCmdImpl.exec(CreateContainerCmdImpl.java:609)
 at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:117)
 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 com.example.demo.DemoApplicationTests.contextLoads(DemoApplicationTests.java:24)
 at java.base/java.util.ArrayList.forEach(Unknown Source)
 at java.base/java.util.ArrayList.forEach(Unknown Source)
@ActiveProfiles("it")
@SpringBootTest
@Testcontainers
@SpringBootTest
class DemoApplicationTests {
    @Container
    public static LocalStackContainer localstack = new LocalStackContainer(
            DockerImageName.parse("localstack/localstack")
                    .withTag("latest"))
            .withServices(S3);

    @Test
    void contextLoads() {
        localstack.start();
    }

}

Boot version: 2.6.7

Dependancies:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>localstack</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <version>1.11.914</version>
            <scope>test</scope>
        </dependency>
cja100
  • 199
  • 2
  • 14

1 Answers1

0

On which OS are you and how do you have Docker installed? This seems to happen during the preflight check, if you disable them, it will likely work for you: https://www.testcontainers.org/features/configuration/#disabling-the-startup-checks

Kevin Wittek
  • 1,369
  • 9
  • 26