Docker Cookbook


| Chapter 1: Getting Started with Docker



Download 6,31 Mb.
Pdf ko'rish
bet24/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   20   21   22   23   24   25   26   27   ...   260
Bog'liq
Docker Cookbook

16 | Chapter 1: Getting Started with Docker


$ mv docker-machine_darwin-amd64 docker-machine
$ chmod +x docker-machine
$ ./docker-machine --version
docker-machine version 0.3.0
With the environment variable 
DIGITALOCEAN_ACCESS_TOKEN
set, you can create your
remote Docker host:
$ ./docker-machine create -d digitalocean foobar
Creating SSH key...
Creating Digital Ocean droplet...
To see how to connect Docker to this machine, run: docker-machine env foobar
If you go back to your DigitalOcean dashboard, you will see that an SSH key has been
created, as well as a new droplet (see Figures 
1-8
 and 
1-9
).
Figure 1-8. DigitalOcean SSH keys generated by Machine
Figure 1-9. DigitalOcean droplet created by Machine
To configure your local Docker client to use this remote Docker host, you execute the
command that was listed in the output of creating the machine:
$ ./docker-machine env foobar
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://104.131.92.15:2376"
export DOCKER_CERT_PATH="/Users/sebastiengoasguen/.docker/machine/machines/foobar"
export DOCKER_MACHINE_NAME="foobar"
# Run this command to configure your shell:
# eval "$(docker-machine env foobar)"
$ eval "$(./docker-machine env foobar)"
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1.9 Starting a Docker Host in the Cloud by Using Docker Machine | 17


Enjoy Docker running remotely on a DigitalOcean droplet created with Docker
Machine.
Discussion
If not specified at the command line, Machine will look for 
DIGI
TALOCEAN_IMAGE

DIGITALOCEAN_REGION
, and 
DIGITALOCEAN_SIZE
environment variables. By default, they are set to 
docker

nyc3
, and
512mb
, respectively.
The 
docker-machine
binary lets you create multiple machines, on multiple providers.
You also have the basic management capabilities: 
start

stop

rm
, and so forth:
$ ./docker-machine
...
COMMANDS:
active Get or set the active machine
create Create a machine
config Print the connection config for machine
inspect Inspect information about a machine
ip Get the IP address of a machine
kill Kill a machine
ls List machines
restart Restart a machine
rm Remove a machine
env Display the commands to set up the environment for the Docker client
ssh Log into or run a command on a machine with SSH
start Start a machine
stop Stop a machine
upgrade Upgrade a machine to the latest version of Docker
url Get the URL of a machine
help, h Shows a list of commands or help for one command
For instance, you can list the machine you created previously, obtain its IP address,
and even connect to it via SSH:
$ ./docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
foobar * digitalocean Running tcp://104.131.92.15:2376
$ ./docker-machine ip foobar
104.131.92.15
$ ./docker-machine ssh foobar
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-57-generic x86_64)
...
Last login: Mon Mar 16 09:02:13 2015 from ...
root@foobar:~#
Before you are finished with this recipe, do not forget to delete the machine you cre‐
ated:

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   20   21   22   23   24   25   26   27   ...   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