Docker Cookbook


| Chapter 2: Image Creation and Sharing



Download 6,31 Mb.
Pdf ko'rish
bet51/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   47   48   49   50   51   52   53   54   ...   260
Bog'liq
Docker Cookbook

50 | Chapter 2: Image Creation and Sharing
www.allitebooks.com


warding ports from a Docker container to the host can be done with the regular
Vagrant command:
config
.
vm
.
network
"forwarded_port"
,
guest
:
5000
,
host
:
5000
Overall, it is my opinion that the Docker support in Vagrant should be seen as a tran‐
sitioning step for developers who might have invested a lot of work with Vagrant and
would like to slowly adopt Docker.
Vagrant also features a Docker 
provisioner
. It can be used when
you are starting virtual machines, provisioning them with configu‐
ration management solutions (e.g., Puppet or Chef) but would also
like to start containers within those virtual machines.
See Also
• Vagrant Docker provider 
configuration
• Vagrant Docker provider 
documentation
2.8 Using Packer to Create a Docker Image
Problem
You have developed several configuration management recipes using 
Chef

Puppet
,
Ansible
, or 
SaltStack
. You would like to reuse those recipes to build Docker images.
Solution
Use 
Packer
 from HashiCorp. Packer is a tool to create identical machine images for
multiple platforms from a single template definition. For example, from a template it
can automatically create images for Amazon EC2 (an Amazon Machine Image, or
AMI), VMware, VirtualBox, and DigitalOcean. One of those target platforms is
Docker.
This means that if you define a Packer template, you can automatically generate a
Docker image. You can also post-process it to tag the image and push it to Docker
Hub (see 
Recipe 2.9
).
The following template shows three main steps. First it specifies a 
builder
; here you
use Docker and specify to use the base image 
ubuntu:14.04
. Second, it defines the
provisioning step. Here we use a simple shell provisioning. Finally, it lists post-
processing steps. Here we tag only the resulting image:

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   47   48   49   50   51   52   53   54   ...   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