-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathecs-docker.yml
More file actions
199 lines (199 loc) · 4.61 KB
/
ecs-docker.yml
File metadata and controls
199 lines (199 loc) · 4.61 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 在ECS实例上部署Docker环境,开放安全组端口,安装Nginx并创建自定义镜像image001:v1。
en: Deploy a Docker environment on the ECS instance, open security group ports,
install Nginx, and create a custom image named `image001:v1`.
Parameters:
InstanceId:
Type: String
Label:
en: ECS Instance ID
zh-cn: ECS实例ID
Description:
en: Please select a test ECS instance whose operating system is linux.
zh-cn: 请选择操作系统为linux系统的测试ECS实例。
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
Status: Running
Resources:
DS_Instances:
Type: DATASOURCE::ECS::Instances
Properties:
InstanceIds:
- Ref: InstanceId
SecurityGroupIngress_80:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DS_Instances
- Instances
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 80/80
SecurityGroupIngress_8080:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DS_Instances
- Instances
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 8080/8080
InstallNginx:
Type: ALIYUN::ECS::RunCommand
DependsOn: ModuleInstallDocker
Properties:
InstanceIds:
- Ref: InstanceId
Type: RunShellScript
Sync: true
Timeout: 3600
CommandContent:
Fn::Sub: |-
#!/bin/bash
docker pull registry-vpc.${ALIYUN::Region}.aliyuncs.com/eci_open/nginx:1.15.10
docker tag registry-vpc.${ALIYUN::Region}.aliyuncs.com/eci_open/nginx:1.15.10 nginx:1.15.10
touch Dockerfile
cat > Dockerfile << EOF
FROM nginx:1.15.10
RUN echo '<h1>Welcome, Docker!</h1>' > /usr/share/nginx/html/index.html
EOF
docker build -t image001:v1 .
docker rm -f nginx-test
docker run --name nginx-test -p 8080:80 -d image001:v1
ModuleInstallDocker:
Version: default
Type: 'MODULE::ACS::OOS::Extension'
Properties:
EcsInstanceIds:
- Ref: InstanceId
PackageName: ACS-Extension-DockerCE-1853370294850618
DependsOn:
- SecurityGroupIngress_80
- SecurityGroupIngress_8080
Outputs:
DockerUrl:
Description:
en: Docker page.
zh-cn: Docker页面。
Value:
Fn::Sub:
- http://${IP}:8080
- IP:
Fn::Jq:
- First
- if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress
end
- Fn::GetAtt:
- DS_Instances
- Instances
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- InstanceId
TemplateTags:
- acs:document:试用教程:在ECS上部署并使用Docker
ALIYUN::ROS::Composer:
e4c8a610:
Rect:
- 240
- 240
- 40
- 100
- 1
- 0
ResT: Composer::ROSParameter::AlibabaCloud
f0b1f42d:
Parent: e4c8a610
Rect:
- 200
- 170
- 60
- 150
- 2
- 0
ResT: Composer::ROSParameter::Region
7be2e7f9:
Res:
- DS_Instances
Parent: f0b1f42d
Rect:
- 40
- 40
- 120
- 215
- 3
- 0
ResT: DATASOURCE::ECS::Instances
2f83111e:
Res:
- SecurityGroupIngress_80
Parent: f0b1f42d
Rect:
- 40
- 40
- 140
- 200
- 3
- 0
Hidden: true
705a4a6f:
Res:
- SecurityGroupIngress_8080
Parent: f0b1f42d
Rect:
- 40
- 40
- 200
- 200
- 3
- 0
Hidden: true
adc84704:
Res:
- InstallNginx
Parent: f0b1f42d
Rect:
- 40
- 40
- 80
- 200
- 3
- 0
Hidden: true
bff3a680:
Res:
- ModuleInstallDocker
Parent: f0b1f42d
Rect:
- 40
- 40
- 140
- 260
- 3
- 0
Hidden: true
ResT: MODULE::ACS::OOS::Extension
399f3ddb:
Parent: f0b1f42d
Edge:
- 2f83111e
- 7be2e7f9
Line: 0:0:0:gray:0
539aa525:
Parent: f0b1f42d
Edge:
- 705a4a6f
- 7be2e7f9
Line: 0:0:0:gray:0