Reputation: 58730
I used CodeFresh to build my Docker Image and push to AWS ECR.
I check my ECR, I can see the pushed there successfully.
I SSH into my EC2, I don't see any content there.
[ec2-user@ip-10-0-0-47 share]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1e4d4eae6520 616934057156.dkr.ecr.us-east-2.amazonaws.com/bheng-api "sh cmd.sh" 29 hours ago Up 29 hours 3002/tcp ecs-api-1-bheng-api-88ef95c7ddc993badf01
44b78781d487 amazon/amazon-ecs-agent:latest "/agent" 30 hours ago Up 30 hours ecs-agent
[ec2-user@ip-10-0-0-47 share]$
[ec2-user@ip-10-0-0-47 share]$
[ec2-user@ip-10-0-0-47 share]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
616934057156.dkr.ecr.us-east-2.amazonaws.com/bheng-api latest 41e9eaa2aff2 29 hours ago 952MB
amazon/amazon-ecs-agent latest 622111e45fde 6 weeks ago 29.4MB
amazon/amazon-ecs-pause 0.1.0 b875fd8f097a 6 weeks ago 963kB
[ec2-user@ip-10-0-0-47 share]$
[ec2-user@ip-10-0-0-47 share]$
[ec2-user@ip-10-0-0-47 share]$
This is the security group of my EC2
Use --update-env to update environment variables
[PM2] Applying action restartProcessId on app [all](ids: 0)
[PM2] [index](0) ✓
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤
│ index │ 0 │ fork │ 23901 │ online │ 1 │ 0s │ 0% │ 12.8 MB │ node │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘
Upvotes: 0
Views: 297
Reputation: 60074
First thing
By doing ls
does not mean it will show the docker image.
If the docker images pull successfully then check it using below command.
docker images
This will print all the images that are running in this ec2 container instance.
something like 56789.dkr.ecr.us-east-2.amazonaws.com/bheng-api:latest
.
As for debugging is a concern you need to check is your docker container is running.
docker ps
This will print running container.
copy the id of the container and run this command.
docker exec -it {container_id} bash|ash
docker logs
docker logs {container_id}
You can also check how images is working by assigning role to your ece container instace and run the following command.
docker run -it --rm -p 80:80 56789.dkr.ecr.us-east-2.amazonaws.com/bheng-api:latest
Again I will mention the steps
- create ECR and push ur docker image
- create Task definition
- create service that runs the instance of that task definition. with out service there will be nothing like container or docker image. once u create service you will se docker image in your ec2 instance.
You can also view tasks events using AWS console under ECS -> cluster -> service -> tasks
If some thing went wrong you will see in the events like
If every thing ok then
Complete image
Upvotes: 3