Unable to pull docker image when running an ECS task

I’ve created the following resources using localstack-pro:

  • ECS cluster
  • ECR repository
  • I’ve pushed a docker image to the ECR repository and created a task definition that uses that image.
    I’m trying to run the ECS task using the following command:
    awslocal ecs run-task
    –task-definition “arn:aws:ecs:us-east-1:000000000000:task-definition/test-task-definition:2”
    –cluster “arn:aws:ecs:us-east-1:000000000000:cluster/test-cluster”

but get the following error:
docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.42/images/create?tag=latest&fromImage=localhost.localstack.cloud%3A4510%2Ftest-image-repo%2Ftest-image-repo: Not Found (“manifest for localhost.localstack.cloud:4510/test-image-repo/test-image-repo:latest not found: manifest unknown: manifest unknown”)

Any idea on how to resolve this issue?

Hello @sakina.gadri,

Would you be able to confirm that following the basic procedure outlined in our documentation results in the same error?

Elastic Container Registry (ECR) | Docs (localstack.cloud)
Elastic Container Service (ECS) | Docs (localstack.cloud)

Hello @Marcel ,

I tried following the guides above but they were not useful. I have made a bit of progress: I am now able to pull the docker image, but running the ECS task fails with the following error:

Execution of ECS task arn:aws:ecs:us-east-1:000000000000:task/test-cluster/91d8edc2-376b-473f-970b-a068e676a16b failed: Docker container returned with exit code 1 - Output:
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack_ext/services/ecs/task_executor.py.enc", line 76, in C
    try:P,Q=DOCKER_CLIENT.start_container(container_name_or_id=H,attach=True);B=f"{to_str(P or C)}\n{to_str(Q or C)}"
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/utils/container_utils/docker_sdk_client.py", line 531, in start_container
    raise ContainerException(
localstack.utils.container_utils.container_client.ContainerException: Docker container returned with exit code 1

Any idea on how to resolve this issue?

I figured this out. The container was failing to run, which I was able to see by passing an environment variable to prevent the container from being deleted after it was run. Here’s the link: Configuration | Docs

1 Like