-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCONTAINERS CMD ECR ECS.txt
133 lines (105 loc) · 3.04 KB
/
CONTAINERS CMD ECR ECS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
this is mbandi git.
-open your local machine
-documents
-src
-create a new folder.
-go to your gitbash
-cd to documents/src/mkdir ecs-ecr-docker
-cd ec2-ecr-dockers
-go to your repository
-go to code
-copy your url and take it to your gitbash and clone without pushing
-cd to ecs-ecr-dockers
-do ls to see all th file.
to save the file in s3
-create a new s3 bucket
-go to upload, create a new folder
- go to upload and upload the files from your local
- by doing addfiles
- back to your local to upload.
on your ec2-instant
-ssh into you server
sudo yum update -y
sudo amazon-linux-extras install docker -y
sudo service docker start
sudo service docker status
FROM ubuntu:12.04
MAINTAINER jjtech
RUN apt-get update && apt-get install -y apache2 && apt-get clean && rm -r /var/lib/apt/lists/*
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
EXPOSE 80
CMD ["/usr/sbin/apache2","-D","FOREGROUND"]
vi Dockerfile
sudo docker build -t jeannel-2 .
sudo ps
sudo docker images
-go to the console
-go to ecr (elastic container registry)
-create a repository
-give it a name
-create
-click on view command push
-click on macs/linux and take it to your terminate
1-4 commands
(A): aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin (AWS REPO)
(B): docker build -t erc-coommand
(C): docker tag erc-coommand:latest (AWS REPO)
(D): docker push (AWS REPO)
ECS
-Ecs clusters
-task
-task definition is like a meter data that carriers that tells ecs how to run docker containers.
Ecs has three manior components
-ecs is for compute
-ecs cluster and task or service and task
definition
The task definition is to defind the port, the memory & cpu, networking,the enviroment variables and is pass as a default if your present enviroment doesn't support it
Task
The task give detail regarding the application you want to run
advantages
-it enables you to control your users
-you can also pull images from ecr by just giving ecs access to ecr.
the two capabilities are
-EC2
-FARGATE
ecs gives you that ability not to stress so much.
to create an empty cluster means there is no resources inside.
question
have you been explose to a situation where you have to provision an empty cluster and what is the use case.
Demo on ecs
-go to ecs
click on ecs cluster
-give your cluster a name
-previous model(on-demand)
-selecte ec2+linux networking
-instance type t2micro
-give it a key pair
-default vpc
-security group default
-selecte 3 default subnet
-iam role role with admin access
-create
TASK DEFINITION
-create new task definition
-ec2
-give it a name
-task role
go to iam and create elastic container service role and attach admin access.
-click on add container
-give your container a name
-image(go to your docker hub and search for httpd and copy it)
-memory limit =128
-port mapping=8080 and 80
-cpu unit=100
-gpus=200
add
Task or Services
-click on cluster
-click on the cluster name you created
-click on services
-click on create
-slecte ec2
-selecte replica
everything else remain default and create.