<p>Did you choose/select <code>ecsTaskExecutionRole</code>? 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.</p>
<p>Also, give task execution role IAM (you may use the same one created before)</p>
<p>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...
<a href="https://i.sstatic.net/HecIf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HecIf.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-05-11T02:06:30.913Z
Yes I selected ecsTaskExecutionRole in all my tries.
Kamal Panhwar
CC BY-SA 4.0
2022-05-11T11:06:31.133Z
I just tried to deploy your image on ECS... It's working..
Sagar Budhathoki Magar
CC BY-SA 4.0
2022-05-10T05:38:16.500Z
2022-05-11T11:10:40.883Z
2022-05-11T11:10:40.883Z
Sagar Budhathoki Magar
<p>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</p>
<pre><code>019ee43da7b91c68126e0d671&quot; status=&quot;CREATED&quot;
level=info time=2022-05-05T09:36:40Z msg=&quot;Container change also resulted in task change&quot; desiredStatus=&quot;RUNNING&quot; knownStatus=&quot;CREATED&quot; task=&quot;cb091374b6ca45629c4f41bfed9c16fb&quot; container=&quot;toxic-container&quot; runtimeID=&quot;a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671&quot;
level=info time=2022-05-05T09:36:40Z msg=&quot;Starting container&quot; task=&quot;cb091374b6ca45629c4f41bfed9c16fb&quot; container=&quot;toxic-container&quot; runtimeID=&quot;a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671&quot;
level=error time=2022-05-05T09:36:41Z msg=&quot;Error transitioning container&quot; container=&quot;toxic-container&quot; runtimeID=&quot;a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671&quot; nextState=&quot;RUNNING&quot; error=&quot;Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: \&quot;/\&quot;: permission denied: unknown&quot; task=&quot;cb091374b6ca45629c4f41bfed9c16fb&quot;
level=info time=2022-05-05T09:36:41Z msg=&quot;Handling container change event&quot; task=&quot;cb091374b6ca45629c4f41bfed9c16fb&quot; container=&quot;toxic-container&quot; runtimeID=&quot;a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671&quot; status=&quot;RUNNING&quot;
level=warn time=2022-05-05T09:36:41Z msg=&quot;Error starting/provisioning container[%s (Runtime ID: %s)];&quot; task=&quot;cb091374b6ca45629c4f41bfed9c16fb&quot; container=&quot;toxic-container&quot; runtimeID=&quot;a6801c731cfa6ddc54ae42e0022d679cd12feab019ee43da7b91c68126e0d671&quot; error=&quot;Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: \&quot;/\&quot;: permission denied: unknown&quot;
</code></pre>
<p>Steps to reproduce it</p>
<ol>
<li>I created ECS cluster on amazon with select EC2 Linux + Networking</li>
<li>for Cluster name* sample</li>
<li>select on-demand instance</li>
<li>EC2 instance type: t2.large</li>
<li>Number of instances* 1</li>
<li>Key pair my key</li>
<li>create new vpc</li>
<li>security group used with ssh and 5000</li>
<li>select ecsInstanceRole
Then click to create</li>
</ol>
<p>On the task definition</p>
<ol>
<li>Create new task definition</li>
<li>Ec2</li>
<li>Task definition name : server</li>
<li>Require capatibilities: Ec2</li>
<li>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</li>
<li>Add</li>
</ol>
<p>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.</p>
<p>Docker image works perfectly on local system, and it is public image.</p>
<p>How can I fix it?</p>

<amazon-web-services><amazon-ec2><amazon-ecs>
Issue in running docker container on ecs
Kamal Panhwar
# Issue in running docker container on ecs

(Asked by: username_0 on 2022-05-05)

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

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

On the task definition

Create new task definition
Ec2
Task definition name : server
Require capatibilities: Ec2
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
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?

**Tags:** amazon-web-services, amazon-ec2, amazon-ecs


---

## 1 answers

### Answer by username_1 on 2022-05-10. Score: 1

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](https://i.sstatic.net/HecIf.png)](https://i.sstatic.net/HecIf.png)

> **Comments:**
> **username_0**: Yes I selected ecsTaskExecutionRole in all my tries.  
> **username_1**: I just tried to deploy your image on ECS... It's working..  

---

