Skip to content

[Bug]: LocalStackContainer - Lambda function doesn't work in MacOS Colima environment #11342

@llowinge

Description

@llowinge

Module

LocalStack

Testcontainers version

1.21.3

Using the latest Testcontainers version?

Yes

Host OS

MacOS

Host Arch

ARM

Docker version

Client: Docker Engine - Community
 Version:           29.1.2
 API version:       1.51 (downgraded from 1.52)
 Go version:        go1.25.5
 Git commit:        890dcca877
 Built:             Tue Dec  2 18:58:46 2025
 OS/Arch:           darwin/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.4.0
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.7
  Git commit:       249d679
  Built:            Wed Sep  3 20:58:55 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

Also note i have colima version 0.9.1 and i'm starting it with colima start --cpu 6 --memory 4 --disk 20 --network-address --mount-type 9p --vm-type=qemu.

After LocalStackContainer is running, i create Lambda function via java code as follows:

            CreateFunctionRequest createRequest = CreateFunctionRequest.builder()
                    .functionName(lambdaName)
                    .runtime("python3.9")
                    .role(lambdaRole)
                    .handler(lambdaHandler)
                    .code(FunctionCode.builder()
                            .zipFile(software.amazon.awssdk.core.SdkBytes.fromByteArray(lambdaZip.readAllBytes()))
                            .build())
                    .build();

            lambdaClient.createFunction(createRequest);

It works on LInux. So it must be related to some misconfiguration on MacOS and related to passing correct docker socket to the inner docker (given the Lambda run as Docker in docker).

I've tried to supply my Docker sock via ENV:

export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/Users/llowinge/.colima/default/docker.sock

which correctly mapped the socket in invocation https://github.com/testcontainers/testcontainers-java/blob/1.21.3/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java#L124 (DockerClientFactory.instance().getRemoteDockerUnixSocketPath() returns mine colima docker sock correctly).

Still i'm having this issue printed from Localstack:

WARN --- [et.reactor-0] l.s.l.i.docker_runtime_exe : WARNING: Docker not available in the LocalStack container but required to run Lambda functions. Please add the Docker volume mount "/var/run/docker.sock:/var/run/docker.sock" to your LocalStack startup. https://docs.localstack.cloud/user-guide/aws/lambda/#docker-not-available

Relevant log output

2025-12-11 08:17:08,768 INFO  [org.apache.camel.quarkus.test.support.aws2.Aws2TestResource] (docker-java-stream--1772715958) STDOUT: 2025-12-11T07:17:08.759  WARN --- [et.reactor-0] l.s.l.i.docker_runtime_exe : WARNING: Docker not available in the LocalStack container but required to run Lambda functions. Please add the Docker volume mount "/var/run/docker.sock:/var/run/docker.sock" to your LocalStack startup. https://docs.localstack.cloud/user-guide/aws/lambda/#docker-not-available
2025-12-11 08:17:08,967 INFO  [org.apache.camel.quarkus.test.support.aws2.Aws2TestResource] (docker-java-stream--1772715958) STDOUT: 2025-12-11T07:17:08.958  INFO --- [et.reactor-0] localstack.request.aws     : AWS lambda.CreateFunction => 201
2025-12-11 08:17:08,978 INFO  [org.apache.camel.quarkus.test.support.aws2.Aws2TestResource] (docker-java-stream--1772715958) STDOUT: 2025-12-11T07:17:08.969 ERROR --- [rvice-task_0] l.services.lambda_.hints   : Failed to pull Docker image because Docker is not available in the LocalStack container but required to run Lambda functions. Please add the Docker volume mount "/var/run/docker.sock:/var/run/docker.sock" to your LocalStack startup. https://docs.localstack.cloud/user-guide/aws/lambda/#docker-not-available
2025-12-11 08:17:08,982 INFO  [org.apache.camel.quarkus.test.support.aws2.Aws2TestResource] (docker-java-stream--1772715958) STDOUT: 2025-12-11T07:17:08.973  INFO --- [et.reactor-0] localstack.request.aws     : AWS lambda.GetFunction => 200

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions