Docker Cookbook


Running Containers via Apache Mesos and Marathon | 219



Download 6,31 Mb.
Pdf ko'rish
bet176/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   172   173   174   175   176   177   178   179   ...   260
Bog'liq
Docker Cookbook

7.11 Running Containers via Apache Mesos and Marathon | 219


To get started, clone the 
playa-mesos
repository from GitHub, start the virtual
machine via Vagrant, and 
ssh
to it:
$ git clone https://github.com/mesosphere/playa-mesos.git
$ vagrant up
$ vagrant ssh
Once the machine is up, you can access the Mesos web interface at 
http://
10.141.141.10:5050
 and the Marathon web interface at 
http://10.141.141.10:8080
.
Discussion on how to use 
Mesos
 and 
Marathon
are beyond the
scope of this book. Refer to the two websites for more information.
Marathon exposes a REST API that you can use to start tasks. Tasks are defined in a
JSON file and can be submitted to the API endpoint via 
curl
. Here is an example task
described in JSON:
{
"id"
:
"http"
,
"cmd"
:
"python -m SimpleHTTPServer $PORT0"
,
"mem"
:
50
,
"cpus"
:
0.1
,
"instances"
:
1
,
"constraints"
:
[
[
"hostname"
,
"UNIQUE"
]
],
"ports"
:
[
0
]
}
The 
id
is the name of the task (also called Application in Marathon). The 
cmd
is what
the application will run (here, a simple HTTP server via Python). What is important
to note is the use of 
ports
, which is set to a list containing 
0
. This means that Mara‐
thon will dynamically allocate a port that this application will use. This dynamic port
is passed to the 
cmd
argument as 
$PORT0
.
Save this JSON description in a file called 
test.json
and submit this application via
curl
:
$ curl -is -H "Content-Type: application/json"
-d @test.json 10.141.141.10:8080/v2/apps
HTTP/1.1 201 Created
...
Once the application starts, you will see it in the UI (
Figure 7-8
) and be able to access
the URL that points to the HTTP server that was just started. Note the port that was
dynamically allocated.

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   172   173   174   175   176   177   178   179   ...   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