title: Aws localstack with lambda from docker image, error when invoke Error: No such container:
body: <p>i'm struggling trying to make localstack working with lambda, hope someone in here could please help me.</p>
  <p>On my machine:
  -Windows 10
  -Docker desktop</p>
  <p>i build a simple python 3.8 app that take as event payload an adress, and return some GPS datas.</p>
  <ul>
  <li>When trying to run it localy into a docker and call it trought API
  --&gt; it works</li>
  <li>When i try to deploie it into a cloud Lambda as a docker image --&gt; it works</li>
  </ul>
  <p>So i want to have a dev environnement locally and try to use the <a href="https://github.com/localstack/localstack/blob/master/README.md" rel="nofollow noreferrer">localstack image</a></p>
  <p>i build my stack with a compose like this.</p>
  <pre><code> version: '3.3'
  services:
    localstack:
      image: localstack/localstack:0.12.15
      ports:
        - &quot;53:53&quot;
        - &quot;443:443&quot;
        - &quot;4566-4583:4566-4583&quot;
      environment:
        - DATA_DIR=/tmp/localstack/data
        - DEBUG=1
        - DEFAULT_REGION=eu-west-1
        - DOCKER_HOST=unix:///var/run/docker.sock
        - LAMBDA_EXECUTOR=docker
        - LAMBDA_REMOVE_CONTAINERS=true
        - LAMBDA_REMOTE_DOCKER=true
        - SERVICES=lambda,s3
      volumes:
        - &quot;/var/run/docker.sock:/var/run/docker.sock&quot;
        - &quot;E:/Sources/container_Lambda/storage_localstack:/tmp/localstack&quot;
      networks:
        - localstacknet
    
    test-lambda:
      image: tes-lambda1:latest
      build:
        context: ./
      networks :
        - localstacknet
  networks:
    localstacknet:
      external: false
      driver : bridge
      name: localstacknet
  </code></pre>
  <p>at launch the https://localhost:4566/health healthcheck is fine</p>
  <pre><code>  &quot;services&quot;: {
      &quot;lambda&quot;: &quot;running&quot;,
      &quot;logs&quot;: &quot;running&quot;,
      &quot;s3&quot;: &quot;running&quot;,
      &quot;cloudwatch&quot;: &quot;running&quot;
    },
    &quot;features&quot;: {
      &quot;persistence&quot;: &quot;initialized&quot;,
      &quot;initScripts&quot;: &quot;initialized&quot;
    }
  }
  </code></pre>
  <p>So now i create my lambda function with</p>
  <pre><code>aws --endpoint-url http://localhost:4566 lambda create-function --function-name test-lambda --code ImageUri=tes-lambda1:latest --role arn:aws:iam::000000000:role/lambda-ex
  </code></pre>
  <p>That returns me a succesful creation</p>
  <pre><code>{
      &quot;FunctionName&quot;: &quot;test-lambda&quot;,
      &quot;FunctionArn&quot;: &quot;arn:aws:lambda:eu-west-1:000000000000:function:test-lambda&quot;,
      &quot;Role&quot;: &quot;arn:aws:iam::000000000:role/lambda-ex&quot;,
      &quot;Handler&quot;: &quot;handler.handler&quot;,
      &quot;Description&quot;: &quot;&quot;,
      &quot;Timeout&quot;: 3,
      &quot;LastModified&quot;: &quot;2021-08-11T08:23:32.406+0000&quot;,
      &quot;Version&quot;: &quot;$LATEST&quot;,
      &quot;VpcConfig&quot;: {},
      &quot;TracingConfig&quot;: {
          &quot;Mode&quot;: &quot;PassThrough&quot;
      },
      &quot;RevisionId&quot;: &quot;50455ed8-737d-4e79-a6ab-93bd31b89d0d&quot;,
      &quot;State&quot;: &quot;Active&quot;,
      &quot;LastUpdateStatus&quot;: &quot;Successful&quot;,
      &quot;PackageType&quot;: &quot;Zip&quot;
  }
  </code></pre>
  <p>But when i want to invoke my lambda with</p>
  <pre><code>aws --endpoint-url http://localhost:4566 lambda invoke --function-name arn:aws:lambda:eu-west-1:000000000000:function:test-lambda response.json
  </code></pre>
  <p>i receive the following response</p>
  <pre><code>{
      &quot;StatusCode&quot;: 200,
      &quot;FunctionError&quot;: &quot;Unhandled&quot;,
      &quot;LogResult&quot;: &quot;&quot;,
      &quot;ExecutedVersion&quot;: &quot;$LATEST&quot;
  }
  </code></pre>
  <p>and the trace log into the localstack container prompt as following.</p>
  <pre><code>localstack_1   | 2021-08-11 08:31:01,715 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
  localstack_1   | 2021-08-11 08:31:01,718 INFO supervisord started with pid 14
  localstack_1   | 2021-08-11 08:31:02,722 INFO spawned: 'dashboard' with pid 20
  localstack_1   | 2021-08-11 08:31:02,725 INFO spawned: 'infra' with pid 21
  localstack_1   | 2021-08-11 08:31:02,732 INFO success: dashboard entered RUNNING state, process has stayed up for &gt; than 0 seconds (startsecs)
  localstack_1   | 2021-08-11 08:31:02,732 INFO exited: dashboard (exit status 0; expected)
  localstack_1   | (. .venv/bin/activate; exec bin/localstack start --host)
  localstack_1   | 2021-08-11 08:31:03,736 INFO success: infra entered RUNNING state, process has stayed up for &gt; than 1 seconds (startsecs)
  localstack_1   | Starting local dev environment. CTRL-C to quit.
  localstack_1   | Waiting for all LocalStack services to be ready
  localstack_1   |
  localstack_1   | LocalStack version: 0.12.15
  localstack_1   | LocalStack Docker container id: d0d3ad8027ce
  localstack_1   | LocalStack build date: 2021-07-07
  localstack_1   | LocalStack build git hash: 46171094
  localstack_1   |
  localstack_1   | Starting edge router (https port 4566)...
  localstack_1   | Starting mock CloudWatch service on http port 4566 ...
  localstack_1   | 2021-08-11T08:31:10:DEBUG:bootstrap.py: Loading plugins - scope &quot;services&quot;, module &quot;localstack&quot;: &lt;function register_localstack_plugins at 0x7f4421007dd0&gt;
  localstack_1   | 2021-08-11T08:31:10:INFO:localstack.multiserver: Starting multi API server process on port 59277
  localstack_1   | [2021-08-11 08:31:10 +0000] [22] [INFO] Running on http://0.0.0.0:59277 (CTRL + C to quit)
  localstack_1   | [2021-08-11 08:31:10 +0000] [22] [INFO] Running on https://0.0.0.0:4566 (CTRL + C to quit)
  localstack_1   | 2021-08-11T08:31:10:INFO:hypercorn.error: Running on http://0.0.0.0:59277 (CTRL + C to quit)
  localstack_1   | 2021-08-11T08:31:10:INFO:hypercorn.error: Running on https://0.0.0.0:4566 (CTRL + C to quit)
  localstack_1   | Starting mock Lambda service on http port 4566 ...
  localstack_1   | Starting mock CloudWatch Logs service on http port 4566 ...
  localstack_1   | Starting mock S3 service on http port 4566 ...
  localstack_1   | 2021-08-11 08:31:11,963:API:  * Running on all addresses.
  localstack_1   |    WARNING: This is a development server. Do not use it in a production deployment.
  localstack_1   | 2021-08-11 08:31:11,964:API:  * Running on http://172.21.0.3:38593/ (Press CTRL+C to quit)
  localstack_1   | 2021-08-11 08:31:11,992:API:  * Running on all addresses.
  localstack_1   |    WARNING: This is a development server. Do not use it in a production deployment.
  localstack_1   | 2021-08-11 08:31:11,995:API:  * Running on http://172.21.0.3:47301/ (Press CTRL+C to quit)
  localstack_1   | Waiting for all LocalStack services to be ready
  localstack_1   | Waiting for all LocalStack services to be ready
  localstack_1   | Ready.
  localstack_1   | 2021-08-11 08:31:24,472:API: 127.0.0.1 - - [11/Aug/2021 08:31:24] &quot;GET / HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11T08:31:24:INFO:localstack.utils.analytics.profiler: Execution of &quot;start_api_services&quot; took 13630.11ms
  localstack_1   | 2021-08-11 08:31:42,295:API: 127.0.0.1 - - [11/Aug/2021 08:31:42] &quot;POST /2015-03-31/functions HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11T08:32:07:INFO:localstack.services.awslambda.lambda_executors: Empty event body specified for invocation of Lambda &quot;arn:aws:lambda:eu-west-1:000000000000:function:test-lambda&quot;
  localstack_1   | 2021-08-11T08:32:07:INFO:localstack.services.awslambda.lambda_executors: Determined main container target IP: 172.21.0.3
  localstack_1   | 2021-08-11T08:32:07:INFO:localstack.services.awslambda.lambda_executors: Running lambda cmd: CONTAINER_ID=&quot;$(docker create -i   -e AWS_REGION=&quot;$AWS_REGION&quot; -e DOCKER_LAMBDA_USE_STDIN=&quot;$DOCKER_LAMBDA_USE_STDIN&quot; -e LOCALSTACK_HOSTNAME=&quot;$LOCALSTACK_HOSTNAME&quot; -e EDGE_PORT=&quot;$EDGE_PORT&quot; -e _HANDLER=&quot;$_HANDLER&quot; -e AWS_LAMBDA_FUNCTION_TIMEOUT=&quot;$AWS_LAMBDA_FUNCTION_TIMEOUT&quot; -e AWS_LAMBDA_FUNCTION_NAME=&quot;$AWS_LAMBDA_FUNCTION_NAME&quot; -e AWS_LAMBDA_FUNCTION_VERSION=&quot;$AWS_LAMBDA_FUNCTION_VERSION&quot; -e AWS_LAMBDA_FUNCTION_INVOKED_ARN=&quot;$AWS_LAMBDA_FUNCTION_INVOKED_ARN&quot; -e AWS_LAMBDA_COGNITO_IDENTITY=&quot;$AWS_LAMBDA_COGNITO_IDENTITY&quot;    --rm &quot;lambci/lambda:&quot; &quot;handler.handler&quot;)&quot;; docker start -ai &quot;$CONTAINER_ID&quot;;
  localstack_1   | 2021-08-11T08:32:07:DEBUG:localstack.services.awslambda.lambda_executors: Lambda arn:aws:lambda:eu-west-1:000000000000:function:test-lambda result / log output:
  localstack_1   |
  localstack_1   | &gt; invalid reference format
  localstack_1   | &gt; Error: No such container:
  localstack_1   | 2021-08-11 08:32:07,498:API: 127.0.0.1 - - [11/Aug/2021 08:32:07] &quot;POST / HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11 08:32:07,526:API: 127.0.0.1 - - [11/Aug/2021 08:32:07] &quot;POST / HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11 08:32:07,556:API: 127.0.0.1 - - [11/Aug/2021 08:32:07] &quot;POST / HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11 08:32:07,598:API: 127.0.0.1 - - [11/Aug/2021 08:32:07] &quot;POST / HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11 08:32:07,632:API: 127.0.0.1 - - [11/Aug/2021 08:32:07] &quot;POST / HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11 08:32:07,664:API: 127.0.0.1 - - [11/Aug/2021 08:32:07] &quot;POST / HTTP/1.1&quot; 200 -
  localstack_1   | 2021-08-11T08:32:07:INFO:localstack.services.awslambda.lambda_api: Error executing Lambda function arn:aws:lambda:eu-west-1:000000000000:function:test-lambda: Lambda process returned error status code: 1. Result: . Output:
  localstack_1   | invalid reference format
  localstack_1   | Error: No such container: Traceback (most recent call last):
  localstack_1   |   File &quot;/opt/code/localstack/localstack/services/awslambda/lambda_api.py&quot;, line 734, in run_lambda
  localstack_1   |     callback=callback,
  localstack_1   |   File &quot;/opt/code/localstack/localstack/services/awslambda/lambda_executors.py&quot;, line 224, in execute
  localstack_1   |     return do_execute()
  localstack_1   |   File &quot;/opt/code/localstack/localstack/services/awslambda/lambda_executors.py&quot;, line 214, in do_execute
  localstack_1   |     return _run(func_arn=func_arn)
  localstack_1   |   File &quot;/opt/code/localstack/localstack/utils/cloudwatch/cloudwatch_util.py&quot;, line 157, in wrapped
  localstack_1   |     raise e
  localstack_1   |   File &quot;/opt/code/localstack/localstack/utils/cloudwatch/cloudwatch_util.py&quot;, line 153, in wrapped
  localstack_1   |     result = func(*args, **kwargs)
  localstack_1   |   File &quot;/opt/code/localstack/localstack/services/awslambda/lambda_executors.py&quot;, line 201, in _run
  localstack_1   |     raise e
  localstack_1   |   File &quot;/opt/code/localstack/localstack/services/awslambda/lambda_executors.py&quot;, line 189, in _run
  localstack_1   |     result = self._execute(func_arn, func_details, event, context, version)
  localstack_1   |   File &quot;/opt/code/localstack/localstack/services/awslambda/lambda_executors.py&quot;, line 451, in _execute
  localstack_1   |     cmd, event=stdin, env_vars=environment, func_details=func_details
  localstack_1   |   File &quot;/opt/code/localstack/localstack/services/awslambda/lambda_executors.py&quot;, line 342, in run_lambda_executor
  localstack_1   |     result,
  localstack_1   | localstack.services.awslambda.lambda_executors.InvocationException: Lambda process returned error status code: 1. Result: . Output:
  localstack_1   | invalid reference format
  localstack_1   | Error: No such container:
  </code></pre>
  <p>Would really appriciate some help to make it work.
  <strong>Thanks a lot</strong></p>