I try to launch EC2 instance with a simple user-data set:
#!/bin/bash
sudo su -
sudo yum -y update
sudo yum install -y docker
sudo service docker start
sudo usermod -aG docker ec2-user
docker pull yeasy/simple-web
docker run -d --rm -it -p 80:80 yeasy/simple-web:latest
But it just doesn't seem to be working. Even when I try to put this command in .sh script an already InService EC2 instance, it still doesn't work.
However, if I run all manually, it is okay.
SG is configured properly as well as NACL.
What can be the problem or how it is possible to troubleshoot?
UPD
I've replaced user-data with:
#!/bin/bash
dnf install docker -y
systemctl enable docker
systemctl start docker
docker pull yeasy/simple-web
docker run -d --rm -it -p 80:80 yeasy/simple-web:latest
And it works. But still wonder what was the problem with first version?