@Test
        public void shouldLabelLambdaContainers() throws IOException {
            AWSLambda lambda = AWSLambdaClientBuilder
                .standard()
                .withEndpointConfiguration(
                    new AwsClientBuilder.EndpointConfiguration(
                        localstack.getEndpoint().toString(),
                        localstack.getRegion()
                    )
                )
                .withCredentials(
                    new AWSStaticCredentialsProvider(
                        new BasicAWSCredentials(localstack.getAccessKey(), localstack.getSecretKey())
                    )
                )
                .build();

            // create function
            byte[] handlerFile = createLambdaHandlerZipFile();
            CreateFunctionRequest createFunctionRequest = new CreateFunctionRequest()
                .withFunctionName("test-function")
                .withRuntime(Runtime.Python311)
                .withHandler("handler.handler")
                .withRole("arn:aws:iam::000000000000:role/test-role")
                .withCode(new FunctionCode().withZipFile(ByteBuffer.wrap(handlerFile)));
            CreateFunctionResult createFunctionResult = lambda.createFunction(createFunctionRequest);
            GetFunctionRequest getFunctionRequest = new GetFunctionRequest()
                .withFunctionName(createFunctionResult.getFunctionName());
            lambda
                .waiters()
                .functionActiveV2()
                .run(new WaiterParameters<GetFunctionRequest>().withRequest(getFunctionRequest));

            // invoke function once
            String payload = "{\"test\": \"payload\"}";
            InvokeRequest invokeRequest = new InvokeRequest()
                .withFunctionName(createFunctionResult.getFunctionName())
                .withPayload(payload);
            InvokeResult invokeResult = lambda.invoke(invokeRequest);
            assertThat(StandardCharsets.UTF_8.decode(invokeResult.getPayload()).toString())
                .as("Invoke result not matching expected output")
                .isEqualTo(payload);

            // assert that the spawned lambda containers has the testcontainers labels set
            DockerClient dockerClient = DockerClientFactory.instance().client();
            Collection<String> nameFilter = Collections.singleton(localstack.getContainerName().replace("_", "-"));
            com.github.dockerjava.api.model.Container lambdaContainer = dockerClient
                .listContainersCmd()
                .withNameFilter(nameFilter)
                .exec()
                .stream()
                .findFirst()
                .orElse(null);
            assertThat(lambdaContainer).as("Lambda container not found").isNotNull();
            Map<String, String> labels = lambdaContainer.getLabels();
            assertThat(labels.get("org.testcontainers")).as("TestContainers label not present").isEqualTo("true");
            assertThat(labels.get("org.testcontainers.sessionId"))
                .as("TestContainers session id not present")
                .isNotNull();
        }
Tests for Localstack Container, used both in bridge network (exposed to host) and docker network modes.
<p>
These tests attempt simple interactions with the container to verify behaviour. The bridge network tests use the
Java AWS SDK, whereas the docker network tests use an AWS CLI container within the network, to simulate usage of
Localstack from within a Docker network.
modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackContainerTest.java