Docker Cookbook


"builders" : [ { "type"



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

"builders"
:
[
{
"type"
:
"docker"
,
"image"
:
"ansible/ubuntu14.04-ansible:stable"
,
"commit"
:
"true"
}
],
"provisioners"
:
[
{
"type"
:
"ansible-local"
,
"playbook_file"
:
"local.yml"
}
],
"post-processors"
:
[
{
"type"
:
"docker-tag"
,
"repository"
:
"how2dock/packer"
,
"tag"
:
"ansible"
2.8 Using Packer to Create a Docker Image | 53


}
]
}
It uses a special Docker image, pulled from Docker Hub, that has Ansible installed in
it. Packer will use the local Ansible CLI to run the Ansible playbook 
local.yml
. The
playbook defined in the template file installs Nginx locally:
---
- hosts: localhost
connection: local
tasks:
- name: install nginx
apt: pkg=nginx state=installed update_cache=true
The result of building with Packer will be a working Docker image 
how2dock/
packer:ansible
$ /home/vagrant/packer build template-ansible.json
...
==> docker: Creating a temporary directory for sharing data...
==> docker: Pulling Docker image: ansible/ubuntu14.04-ansible:stable
docker: Pulling repository ansible/ubuntu14.04-ansible
...
==> docker: Provisioning with Ansible...
docker: Creating Ansible staging directory...
docker: Creating directory: /tmp/packer-provisioner-ansible-local
docker: Uploading main Playbook file...
...
docker:
docker: PLAY [localhost] **************************************
docker:
docker: GATHERING FACTS ***************************************
docker: ok: [localhost]
docker:
docker: TASK: [install nginx] *********************************
docker: changed: [localhost]
docker:
docker: PLAY RECAP ********************************************
docker: localhost : ok=2 changed=1 unreachable=0 failed=0
docker:
==> docker: Committing the container
..
docker (docker-tag): Repository: how2dock/packer:ansible
Build 'docker' finished.
A new image is now available, 
how2dock/packer:ansible
, that was built using an Ansi‐
ble playbook. You can start a container based on this image and launch the applica‐
tion as you did before. This interesting workflow allows you to keep the benefit of
your configuration management recipes/playbooks while starting to use containers
instead of virtual machines.

Download 6,31 Mb.

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