Docker Cookbook


Migrating from Vagrant to Docker with the Docker Provider | 49



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

2.7 Migrating from Vagrant to Docker with the Docker Provider | 49


$ vagrant up --provider=docker
Bringing machine 'default' up with 'docker' provider...
==> default: Building the container from a Dockerfile...
default: Sending build context to Docker daemon 8.704 kB
default: Step 0 : FROM ubuntu:14.04
...
==> default: Creating the container...
default: Name: provider_default_1421147689
default: Image: 324f2babf057
default: Volume: /vagrant/provider:/vagrant
default: Port: 5000:5000
default:
default: Container created: efe111afb8b9d3ff
==> default: Starting container...
==> default: Provisioners will not be run since container doesn't support SSH.
Once the 
vagrant up
is over, the container will be running and an image will have
been created. You can use the regular Docker commands to interact with the con‐
tainer or use the new 
vagrant docker-logs
and 
vagrant docker-run
commands.
Standard commands like 
vagrant status
and 
vagrant destroy
will also work with
your containers.
It is likely that you will not install SSH in your container. There‐
fore, the Vagrant provisioners will not be able to run. Any software
installation within your container will need to happen through the
Dockerfile.
Discussion
I created a simple environment to help you test this recipe. Similarly to other recipes,
you can clone the Git repository that accompanies this book and head over to the
recipe examples. An Ubuntu 14.04 virtual machine will be started, and Docker will be
installed as well as Vagrant. In the 
/vagrant/provider
directory, you will find yet
another Vagrantfile (shown previously), and a Dockerfile. This Dockerfile builds a
simple Flask application in the container:
$ git clone
$ cd ch02/vagrantprovider/
$ vagrant up
$ vagrant ssh
$ cd /vagrant/provider
$ vagrant up --provider=docker
The possible configurations of the Vagrantfile are almost a one-to-one match with
directives in a Dockerfile. You can define what software to install in a container, what
environment variables to pass, which ports to expose, which containers to link to, and
which volumes to mount. The interesting thing is that Vagrant will attempt to trans‐
late the regular Vagrant configuration into Docker run options. For instance, for‐

Download 6,31 Mb.

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