I mounted EBS to ecs-enabled instance in AWS.
For EBS to be visible to docker, docker daemon has to be restarted. I added appropriate commands to the user-data. But I am unable to restart ecs-agent docker container from the user data.
Following is my user-data:
#!/bin/bash
echo ECS_CLUSTER=MYCLUSTER>> /etc/ecs/ecs.config
mkfs -t ext4 /dev/sdb
mkdir /db/
mount /dev/sdb /db/
service docker stop
service docker start
docker start ecs-agent
On SSH, I could see that the ecs-agent container is created but it is not running. When I start the container manually, it is working. What is the correct way to start it during instance launch? What am I missing in my user-data script?
I need to create a launch configuration for use in my auto-scaling group. Instances should have EBS enabled and visible to docker.