Issue in running docker container on ecs



  • I am trying to run container on ecs but there is one specific image which is not running and give me error. I can see in docker container ec2 that image is pulled and it tried to run but it gave following error

    019ee43da7b91c68126e0d671" status="CREATED"
    level=info time=2022-05-05T09:36:40Z msg="Container change also resulted in task change" desiredStatus="RUNNING" knownStatus="CREATED" task="cb091374b6ca45629c4f41bfed9c16fb" container="toxic-container" runtimeID="a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671"
    level=info time=2022-05-05T09:36:40Z msg="Starting container" task="cb091374b6ca45629c4f41bfed9c16fb" container="toxic-container" runtimeID="a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671"
    level=error time=2022-05-05T09:36:41Z msg="Error transitioning container" container="toxic-container" runtimeID="a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671" nextState="RUNNING" error="Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: \"/\": permission denied: unknown" task="cb091374b6ca45629c4f41bfed9c16fb"
    level=info time=2022-05-05T09:36:41Z msg="Handling container change event" task="cb091374b6ca45629c4f41bfed9c16fb" container="toxic-container" runtimeID="a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671" status="RUNNING"
    level=warn time=2022-05-05T09:36:41Z msg="Error starting/provisioning container[%s (Runtime ID: %s)];" task="cb091374b6ca45629c4f41bfed9c16fb" container="toxic-container" runtimeID="a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671" error="Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: \"/\": permission denied: unknown"
    

    Steps to reproduce it

    1. I created ECS cluster on amazon with select EC2 Linux + Networking
    2. for Cluster name* sample
    3. select on-demand instance
    4. EC2 instance type: t2.large
    5. Number of instances* 1
    6. Key pair my key
    7. create new vpc
    8. security group used with ssh and 5000
    9. select ecsInstanceRole Then click to create

    On the task definition

    1. Create new task definition
    2. Ec2
    3. Task definition name : server
    4. Require capatibilities: Ec2
    5. click Add Container a. server-container b. image: quay.io/codait/max-toxic-comment-classifier c. Memory Limit 4096 d. port mapping: host Port: 5000 , container port: 5000
    6. Add

    Now task created so I click to run task, and it started, then it pull image and I can see image is pulled, but when it runs it give me above error.

    Docker image works perfectly on local system, and it is public image.

    How can I fix it?



  • Did you choose/select ecsTaskExecutionRole? When creating a new task definition. Cause it's a must. OR create a role manually for tasks that gives API requests permission to AWS services.

    Also, give task execution role IAM (you may use the same one created before)

    Update: I deployed your image with ECS EC2 and it's working fine... I'm not sure but I think you have issues using/defining roles... enter image description here




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2