title: Running a Docker image from ECR on ECS
body: <p>I have a docker image in ECR.  I want to run it in ECS.  I've followed the steps in the AWS docs which take me <a href="https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun" rel="nofollow noreferrer">here</a>.  That runs through a series of steps that set up some kind of ECS cluster, but it never asks which docker image in ECR that I want to run.</p>
  
  <p>Running a docker image is very simple, but ECS seems overly complex for what I'm trying to do (run a docker image of a simple web service).  <a href="http://blog.jimtough.com/docker-on-aws-part-2-creating-an-ecs-cluster-to-host-the-docker-image/" rel="nofollow noreferrer">This</a> is the best explanation I've found.  Maybe I've missed something.</p>
  
  <p>Amazon's docs seem to go off on tangents and never get back to a docker image in ECR.  Is there a better explanation of how run an ECR image in ECS?</p>
  
  <p>Edit:  adding task definition json:</p>
  
  <pre><code>{
    "ipcMode": null,
    "executionRoleArn": "arn:aws:iam::504084722442:role/ecsTaskExecutionRole",
    "containerDefinitions": [
      {
        "dnsSearchDomains": null,
        "logConfiguration": {
          "logDriver": "awslogs",
          "options": {
            "awslogs-group": "/ecs/first-run-task-definition",
            "awslogs-region": "us-east-2",
            "awslogs-stream-prefix": "ecs"
          }
        },
        "entryPoint": [
          "sh",
          "-c"
        ],
        "portMappings": [
          {
            "hostPort": 80,
            "protocol": "tcp",
            "containerPort": 80
          }
        ],
        "command": [
          "/bin/sh -c \"echo '&lt;html&gt; &lt;head&gt; &lt;title&gt;Amazon ECS Sample App&lt;/title&gt; &lt;style&gt;body {margin-top: 40px; background-color: #333;} &lt;/style&gt; &lt;/head&gt;&lt;body&gt; &lt;div style=color:white;text-align:center&gt; &lt;h1&gt;Amazon ECS Sample App&lt;/h1&gt; &lt;h2&gt;Congratulations!&lt;/h2&gt; &lt;p&gt;Your application is now running on a container in Amazon ECS.&lt;/p&gt; &lt;/div&gt;&lt;/body&gt;&lt;/html&gt;' &gt;  /usr/local/apache2/htdocs/index.html &amp;&amp; httpd-foreground\""
        ],
        "linuxParameters": null,
        "cpu": 256,
        "environment": [],
        "resourceRequirements": null,
        "ulimits": null,
        "dnsServers": null,
        "mountPoints": [],
        "workingDirectory": null,
        "secrets": null,
        "dockerSecurityOptions": null,
        "memory": null,
        "memoryReservation": 512,
        "volumesFrom": [],
        "image": "504084722442.dkr.ecr.us-east-2.amazonaws.com/dean.w.schulze.5040",
        "disableNetworking": null,
        "interactive": null,
        "healthCheck": null,
        "essential": true,
        "links": [],
        "hostname": null,
        "extraHosts": null,
        "pseudoTerminal": null,
        "user": null,
        "readonlyRootFilesystem": null,
        "dockerLabels": null,
        "systemControls": null,
        "privileged": null,
        "name": "sample-app"
      }
    ],
    "placementConstraints": [],
    "memory": "512",
    "taskRoleArn": null,
    "compatibilities": [
      "EC2",
      "FARGATE"
    ],
    "taskDefinitionArn": "arn:aws:ecs:us-east-2:504084722442:task-definition/first-run-task-definition:2",
    "family": "first-run-task-definition",
    "requiresAttributes": [
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "ecs.capability.execution-role-ecr-pull"
      },
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
      },
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "ecs.capability.task-eni"
      },
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "com.amazonaws.ecs.capability.ecr-auth"
      },
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "ecs.capability.execution-role-awslogs"
      },
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
      },
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
      },
      {
        "targetId": null,
        "targetType": null,
        "value": null,
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
      }
    ],
    "pidMode": null,
    "requiresCompatibilities": [
      "FARGATE"
    ],
    "networkMode": "awsvpc",
    "cpu": "256",
    "revision": 2,
    "status": "ACTIVE",
    "volumes": []
  }
  </code></pre>