<!-- 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)

self.destroy_docker_container(func_arn)
                env_vars_str = ' '.join(['-e {}={}'.format(k, cmd_quote(v)) for (k, v) in env_vars])
                network = config.LAMBDA_DOCKER_NETWORK
                network_str = '--network="%s"' % network if network else ''
                dns = config.LAMBDA_DOCKER_DNS
                dns_str = '--dns="%s"' % dns if dns else ''
                mount_volume = not config.LAMBDA_REMOTE_DOCKER
                lambda_cwd_on_host = Util.get_host_path_for_path_in_docker(lambda_cwd)
                if (':' in lambda_cwd and '\\' in lambda_cwd):
                    lambda_cwd_on_host = Util.format_windows_path(lambda_cwd_on_host)
                mount_volume_str = '-v "%s":/var/task' % lambda_cwd_on_host if mount_volume else ''
                
                LOG.debug('Creating container: %s' % container_name)
                cmd = (
                    '%s create'
                    ' %s'  
                    ' --name "%s"'
                    ' --entrypoint /bin/bash'  
                    ' %s'
                    ' --interactive'  
                    ' -e AWS_LAMBDA_EVENT_BODY="$AWS_LAMBDA_EVENT_BODY"'
                    ' -e HOSTNAME="$HOSTNAME"'
                    ' -e LOCALSTACK_HOSTNAME="$LOCALSTACK_HOSTNAME"'
                    ' -e EDGE_PORT="$EDGE_PORT"'
                    '  %s'  
                    '  %s'  
                    '  %s'  
                    ' %s'
                ) % (docker_cmd, rm_flag, container_name, mount_volume_str,