The problem is that when uploading docker image of service to the Amazon container registry, the docker image does not run after adding it as a Task.
See (https://aws.amazon.com/getting-started/tutorials/deploy-docker-containers/)
Step1: Push to AWS Container service private image registry
docker push 734122228327.dkr.ecr.us-east-2.amazonaws.com/joethecoder2:latest
## Step2: SSH into running Docker instance
ssh -i "containerservice.pem" [email protected] The authenticity of host 'ec2-18-217-248-112.us-east-2.compute.amazonaws.com (18.217.248.112)' can't be established. ECDSA key fingerprint is SHA256:wCeAUed36nKeQjEbSDsYjzq8Z5mpNY4pbcahw2mSozs. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'ec2-18-217-248-112.us-east-2.compute.amazonaws.com,18.217.248.112' (ECDSA) to the list of known hosts.
| __| __| | ( _ \ Amazon ECS-Optimized Amazon Linux AMI 2017.09.d ____|_|____/
For documentation visit, http://aws.amazon.com/documentation/ecs
Docker ps running instances
[ec2-user@ip-10-0-0-102 ~]$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c90a2116f3ab amazon/amazon-ecs-agent:latest "/agent" About an hour ago Up About an hour ecs-agent [ec2-user@ip-10-0-0-102 ~]$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c90a2116f3ab amazon/amazon-ecs-agent:latest "/agent" About an hour ago Up About an hour ecs-agent
Results: Do not show that joethecoder2 image is running. WHY?
[ec2-user@ip-10-0-0-102 ~]$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE amazon/amazon-ecs-agent latest 2d99efccdfef 3 weeks ago 26.8MB amazon/amazon-ecs-pause 0.1.0 c846030090b6 3 weeks ago 964kB [ec2-user@ip-10-0-0-102 ~]$
Problem conclusion:
The docker image that was uploaded using Push was not included in the running container service, when adding the Task was done like the example instructions for how to deploy docker containers. (I configured the Task in step 2, and 3, and then setup the cluster in Step 4) See (https://aws.amazon.com/getting-started/tutorials/deploy-docker-containers/)
Test Data
However, when I try to curl the service it does not connect: curl ec2-18-217-248-112.us-east-2.compute.amazonaws.com:8080 curl: (7) Failed to connect to ec2-18-217-248-112.us-east-2.compute.amazonaws.com port 8080: Connection refused
Further inspection:
Further inspection shows, that the docker service that should be running for joethecoder2 is not running in the docker instance that should be running on the container service node ec2-18-217-248-112.us-east-2.compute.amazonaws.com
docker run your-image
? – jingx