Docker Cookbook


See Also • Wharfee  source code • Wharfee official  website 7.7 Using the Wharfee Interactive Shell | 209



Download 6,31 Mb.
Pdf ko'rish
bet169/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   165   166   167   168   169   170   171   172   ...   260
Bog'liq
Docker Cookbook

See Also
• Wharfee 
source code
• Wharfee official 
website
7.7 Using the Wharfee Interactive Shell | 209


7.8 Orchestrating Containers with Ansible Docker Module
Problem
You have developed some expertise with 
Ansible
to configure your servers and
orchestrate application deployment. You would like to take advantage of this exper‐
tise and use Ansible to manage Docker containers.
Solution
Use the Ansible Docker 
module
. This module is part of the Ansible core, so after
installing Ansible, no additional packages need to be installed.
Ansible will run from your local machine, connect over SSH to your Docker hosts,
and use the 
docker-py
API client to issue calls to the Docker daemon.
For example, to start an Nginx container in detached mode with a port mapping, you
would write an Ansible 
playbook
 like this:
- hosts: nginx
tasks:
- name: Run nginx container
docker: image=nginx:latest detach=true ports=80:80
Discussion about how to use Ansible is beyond the scope of this
recipe. See the Ansible 
documentation
.
Discussion
To get you up and running with the Ansible Docker module, you can use the
Vagrantfile accompanying this recipe. This will start a virtual machine acting as a
Docker host with the 
docker-py
client installed. Two playbooks, an inventory file,
and some Ansible configurations are also available to make it turnkey.
The first task is to install Ansible on your local machine:
$ sudo pip install ansible
Then to test the Nginx playbook, follow these instructions:
$ git clone https://github.com/how2dock/docbook.git
$ cd ch07/ansible
$ tree
.
├── README.md
├── Vagrantfile

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   165   166   167   168   169   170   171   172   ...   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