Docker Cookbook


| Chapter 7: The Docker Ecosystem: Tools



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

210 | Chapter 7: The Docker Ecosystem: Tools


├── ansible.cfg
├── dock.yml
├── inventory
├── solo
│ ├── Vagrantfile
│ └── dock.yml
└── wordpress.yml
$ vagrant up
The Nginx playbook shown in the solution section is in the 
dock.yml
file. To start this
container using Ansible, run the playbook. Once it finishes, open your browser at
http://192.168.33.10
and you will see the welcome screen of Nginx. You can also con‐
nect to the VM with 
vagrant ssh
and check the running container with the usual
docker ps
command.
$ ansible-playbook -u vagrant dock.yml
PLAY [nginx] ******************************************************************
GATHERING FACTS ***************************************************************
ok: [192.168.33.10]
TASK: [Run nginx container] ***************************************************
changed: [192.168.33.10]
PLAY RECAP ********************************************************************
192.168.33.10 : ok=2 changed=1 unreachable=0 failed=0
You can kill this Nginx container with 
docker kill
within the virtual machine or run
a playbook that sets the state of the container to 
killed
:
- hosts: nginx
tasks:
- name: Kill nginx container
docker: image=nginx:latest detach=true ports=80:80 state=killed
If you want to try a more complex example, check the WordPress playbook 
word‐
press.yml
. You have deployed WordPress several times already (see 
Recipe 1.15
 or
Recipe 1.16
). Run the playbook and open your browser at 
http://192.168.33.10
 and
enjoy WordPress once again. (You will need to have killed any container using port 80
on the host; otherwise, you will get a port conflict error).
$ ansible-playbook -u vagrant wordpress.yml
PLAY [wordpress] **************************************************************
GATHERING FACTS ***************************************************************
ok: [192.168.33.10]
TASK: [Docker pull mysql] *****************************************************
changed: [192.168.33.10]
TASK: [Docker pull wordpress] *************************************************

Download 6,31 Mb.

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