Docker Cookbook


| Chapter 6: Optimized Operating System Distributions for Docker



Download 6,31 Mb.
Pdf ko'rish
bet141/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   137   138   139   140   141   142   143   144   ...   260
Bog'liq
Docker Cookbook

172 | Chapter 6: Optimized Operating System Distributions for Docker


6.2 Starting a Container on CoreOS via cloud-init
Problem
Knowing how to start a CoreOS instance via Vagrant, you would like to use 
cloud-
init
 to start a container at boot time.
Solution
You know how to start a CoreOS instance via Vagrant (see 
Recipe 6.1
). You now need
to add a 
systemd
unit within the 
user-data
file. CoreOS will automatically launch this
unit during the boot process.
Create a new 
user-data
file that contains only the following:
#cloud-config
coreos:
units:
- name: es.service
command: start
content: |
[Unit]
After=docker.service
Requires=docker.service
Description=starts Elastic Search container
[Service]
TimeoutStartSec=0
ExecStartPre=/usr/bin/docker pull dockerfile/elasticsearch
ExecStart=/usr/bin/docker run -d -p 9200:9200 -p 9300:9300 \
dockerfile/elasticsearch
If you still have a CoreOS instance running from 
Recipe 6.1
, destroy it with 
vagrant
destroy
and bring up a new one with 
vagrant up
.
The 
docker.service
unit starts automatically in CoreOS, so there
is no need to specify it in the 
user-data
file.
The virtual machine will boot quickly and start the 
es.service
defined in the cloud
config file. Docker will start by pulling the 
dockerfile/elasticsearch
image. This could
take some time, so be patient and monitor the download via 
docker images
. Once
the image is downloaded, the container will get started (see the 
ExecStart
command
in the 
user-data
file):

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   137   138   139   140   141   142   143   144   ...   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