Docker Cookbook


Starting a Docker Host on AWS EC2 | 237



Download 6,31 Mb.
Pdf ko'rish
bet188/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   184   185   186   187   188   189   190   191   ...   260
Bog'liq
Docker Cookbook

8.2 Starting a Docker Host on AWS EC2 | 237


The Amazon Linux AMI also contains 
cloud-init
, which has become the standard
for configuring cloud instances at boot time. This allows you to pass 
user data
at
instance creation. 
cloud-init
parses the content of the user data and executes the
commands. Using the AWS CLI, you can pass some user data to automatically install
Docker. The small downside is that it needs to be base64-encoded.
Create a small bash script with the two commands from earlier:
#!/bin/bash
yum -y install docker
service docker start
Encode this script and pass it to the instance creation command:
$ udata="$(cat docker.sh | base64 )"
$ aws ec2 run-instances --image-id ami-7b3db00c \
--count 1 \
--instance-type t1.micro \
--key-name cookbook \
--user-data $udata
$ ssh -i ~/.ssh/id_rsa_cookbook ec2-user@
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
With the Docker daemon running, if you wanted to access it
remotely, you would need to set up TLS access (see 
Recipe 4.9
), and
open port 2376 in your security group.
Using this CLI is not Docker-specific. This CLI gives you access to
the complete set of AWS APIs. However, using it to start instances
and install Docker in them significantly streamlines the provision‐
ing of Docker hosts.
See Also

Installing the AWS CLI

Configuring the AWS CLI

Launching an instance via the AWS CLI
238 | Chapter 8: Docker in the Cloud


8.3 Starting a Docker Host on Google GCE
Problem
You want to start a VM instance on the Google GCE cloud and use it as a Docker
host.

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   184   185   186   187   188   189   190   191   ...   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