Docker Cookbook



Download 6,31 Mb.
Pdf ko'rish
bet207/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   203   204   205   206   207   208   209   210   ...   260
Bog'liq
Docker Cookbook

import
boto
import
base64
264 | Chapter 8: Docker in the Cloud


userdata
=
"""
#!/bin/bash
echo ECS_CLUSTER=cookbook >> /etc/ecs/ecs.config
"""
c
=
boto
.
connect_ec2
()
c
.
run_instances
(
'ami-34ddbe5c'
,
\
key_name
=
'ecs'
,
\
instance_type
=
't2.micro'
,
\
instance_profile_name
=
'cookbook'
,
\
user_data
=
base64
.
b64encode
(
userdata
))
Once you are done with the cluster, you can delete it entirely with the 
aws ecs
delete-cluster --cluster cookbook
command.
See Also
• The 
ECS
agent on GitHub
8.13 Starting Docker Containers on an ECS Cluster
Problem
You know how to create an ECS cluster on AWS (see 
Recipe 8.12
), and now you are
ready to start containers on the instances forming the cluster.
Solution
Define your containers or group of containers in a definition file in JSON format. 
This will be called a 
task
. You will register this task and then run it; it is a two-step
process. Once the task is running in the cluster, you can 
list

stop
, and 
start
it.
For example, to run Nginx in a container based on the 
nginx
image from Docker
Hub, you create the following task definition in JSON format:
[
{
"environment"
:
[],
"name"
:
"nginx"
,
"image"
:
"nginx"
,
"cpu"
:
10
,

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   203   204   205   206   207   208   209   210   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish