Docker Community Forums

Share and learn in the Docker community.

How to specify 'docker run' options in Amazon AWS ECS task JSON file


(Moonsyim) #1

Hello,
I couldn’t get any good information from googling for this issue.

Normally my commands are

docker run -i -t -d --name mysql -p 3306:3306 moonsyim/amazon-linux-ami-mysql-20150630:0.1 /bin/bash

docker run -i -t -d --name tomcat -p 8080:8080 --link mysql:mysql moonsyim/amazon-linux-ami-tomcat-20150630:0.5 /bin/bash

I’d like to run these two containers through AWS ECS task JSON file.
but I couldn’t get how to specify ‘docker run’ options such as -i -t -d

Currently, 2 Containers were pulled, but exited (0) after running by AWS ECS task.

my JSON looks like {
“taskDefinitionArn”: “arn:aws:ecs:us-west-2:035824440926:task-definition/Task_Liferay_MySql_01:4”,
“status”: “ACTIVE”,
“revision”: 4,
“containerDefinitions”: [
{
“volumesFrom”: [],
“portMappings”: [
{
“hostPort”: 8080,
“containerPort”: 8080,
“protocol”: “tcp”
}
],
“command”: [],
“environment”: [],
“essential”: true,
“entryPoint”: [],
“links”: [],
“mountPoints”: [],
“memory”: 2000,
“name”: “Container_Liferay_01”,
“cpu”: 10,
“image”: “moonsyim/amazon-linux-ami-tomcat-20150630:0.5”
},
{
“volumesFrom”: [],
“portMappings”: [
{
“hostPort”: 3306,
“containerPort”: 3306,
“protocol”: “tcp”
}
],
“command”: [],
“environment”: [],
“essential”: true,
“entryPoint”: [],
“links”: [],
“mountPoints”: [],
“memory”: 1000,
“name”: “Container_MySql_01”,
“cpu”: 10,
“image”: “moonsyim/amazon-linux-ami-mysql-20150630:0.1”
}
],
“volumes”: [],
“family”: “Task_Liferay_MySql_01”
}