<!-- Love localstack? Please consider supporting our collective:
:point_right:  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...
[x] bug report
[ ] feature request

# Detailed description
Simple Rust Lambda function got stuck in localstack.

## Expected behavior
Lambda works normally as it does in AWS.

## Actual behavior
Lambda can start, but it gets stuck as soon as it tries to read request.

Via `docker logs <container id>` I can see:
```
Started!
START RequestId: 8736a8ca-e1b1-151b-ec25-1d825d277d49 Version: $LATEST
```

# Steps to reproduce
## Command used to start LocalStack
```yaml
services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
    image: localstack/localstack
    ports:
      - "4566-4599:4566-4599"
      - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
    environment:
      - SERVICES=${SERVICES- }
      - DEBUG=${DEBUG- }
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=${PORT_WEB_UI- }
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
      - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR-/tmp/localstack}
      - HOSTNAME_EXTERNAL=xxx.lan
    volumes:
      - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"
```

Then `docker-compose up`.

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)
```rust
use lambda_runtime::error::HandlerError;
use lambda_runtime::lambda;
use serde::{Deserialize, Serialize};
use std::error::Error;

#[derive(Deserialize, Debug, Clone)]
struct FooRequest {
    bar: String,
}

#[derive(Serialize, Clone)]
struct FooResponse {
    success: bool,
}

fn main() -> Result<(), Box<dyn Error>> {
    println!("Started!");

    lambda!(hello_world);

    Ok(())
}

fn hello_world(ev: FooRequest, _ctx: lambda_runtime::Context) -> Result<FooResponse, HandlerError> {
    println!("{:?}", ev);
    Ok(FooResponse { success: true })
}
```

```sh
$ cargo build --target=x86_64-unknown-linux-musl --release
$ cp target/x86_64-unknown-linux-musl/release/hello_world ./bootstrap
$ zip -j lambda.zip bootstrap
$ aws --endpoint-url http://xxx:4566 lambda create-function --function-name "helloworld" --handler "hello.world" --runtime provided.al2 \
    --zip-file fileb://./lambda.zip --role "" --environment Variables={RUST_BACKTRACE=1} \
    --timeout 30 --memory-size 512
$ aws --endpoint-url http://xxx:4566 lambda invoke --function-name helloworld --payload '{"bar":"bar"}' ./output.json
```

┆Issue is synchronized with this [Jira Bug](https://localstack.atlassian.net/browse/LOC-341) by [Unito](https://www.unito.io/learn-more)

""" Contains basic information about a docker container. """
    def __init__(self, name, entry_point):
        self.name = name
        self.entry_point = entry_point
class LambdaExecutorContainers(LambdaExecutor):
    """ Abstract executor class for executing Lambda functions in Docker containers """
    def prepare_execution(self, func_arn, env_vars, runtime, command, handler, lambda_cwd):
        raise Exception('Not implemented')
    def _docker_cmd(self):
        """ Return the string to be used for running Docker commands. """
        return config.DOCKER_CMD
    def prepare_event(self, environment, event_body):
        """ Return the event as a stdin string. """
        
        environment['AWS_LAMBDA_EVENT_BODY'] = event_body
        return None
    def _execute(self, func_arn, func_details, event, context=None, version=None):
        lambda_cwd = func_details.cwd
        runtime = func_details.runtime
        handler = func_details.handler
        environment = self._prepare_environment(func_details)
        
        if config.USE_SSL:
            environment['USE_SSL'] = '1'
        
        if not event:
            LOG.warning('Empty event body specified for invocation of Lambda "%s"' % func_arn)
            event = {}
        event_body = json.dumps(json_safe(event))
        stdin = self.prepare_event(environment, event_body)