1 2 3 4 5 6 7 | $ docker-machine create --driver virtualbox testingINFO[0000] Creating SSH key... INFO[0000] Creating VirtualBox VM... INFO[0006] Starting VirtualBox VM... INFO[0006] Waiting for VM to start... INFO[0038] "testing" has been created and is now the active machine. INFO[0038] To point your Docker client at it, run this in your shell: $(docker-machine env testing) |
1 2 3 4 5 6 | $ docker-machine env testingexport DOCKER_TLS_VERIFY=yesexport DOCKER_CERT_PATH=/Users/russ/.docker/machine/machines/testingexport DOCKER_HOST=tcp://192.168.99.100:2376$ docker-machine config testing--tls --tlscacert=/Users/russ/.docker/machine/machines/testing/ca.pem --tlscert=/Users/russ/.docker/machine/machines/testing/cert.pem --tlskey=/Users/russ/.docker/machine/machines/testing/key.pem -H="tcp://192.168.99.100:2376 |
1 2 3 4 5 6 7 8 9 10 | $ docker $(docker-machine config testing) run busybox echo hello worldUnable to find image 'busybox:latest' locally511136ea3c5a: Pull complete df7546f9f060: Pull complete ea13149945cb: Pull complete 4986bf8c1536: Pull complete busybox:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.Status: Downloaded newer image for busybox:latesthello world |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | $ docker-machine ssh testingBoot2Docker version 1.5.0, build master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015Docker version 1.5.0, build a8a31efdocker@testing:~$ uname -aLinux testing 3.18.5-tinycore64 #1 SMP Sun Feb 1 06:02:30 UTC 2015 x86_64 GNU/Linuxdocker@testing:~$ cat /etc/*releaseNAME=Boot2DockerVERSION=1.5.0ID=boot2dockerID_LIKE=tclVERSION_ID=1.5.0PRETTY_NAME="Boot2Docker 1.5.0 (TCL 5.4); master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015"ANSI_COLOR="1;34"HOME_URL="http://boot2docker.io"SUPPORT_URL="https://github.com/boot2docker/boot2docker"BUG_REPORT_URL="https://github.com/boot2docker/boot2docker/issues"docker@testing:$ exit$ |
1 2 3 4 5 6 7 8 9 10 | $ docker-machine create \→ --driver digitalocean \→ --digitalocean-access-token cdb81ed0575b5a8d37cea0d06c9690daa074b1276892fc8473bdda97eb7c65ae \→ dotestingINFO[0000] Creating SSH key... INFO[0000] Creating Digital Ocean droplet... INFO[0004] Waiting for SSH... INFO[0071] Configuring Machine... INFO[0120] "dotesting" has been created and is now the active machine. INFO[0120] To point your Docker client at it, run this in your shell: $(docker-machine env dotesting) |
1 2 3 4 5 6 7 8 9 10 | $ docker $(docker-machine config dotesting) run busybox echo hello worldUnable to find image 'busybox:latest' locally511136ea3c5a: Pull complete df7546f9f060: Pull complete ea13149945cb: Pull complete 4986bf8c1536: Pull complete busybox:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.Status: Downloaded newer image for busybox:latesthello world |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | $ docker-machine ssh dotestingWelcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic x86_64)Documentation: https://help.ubuntu.com/System information as of Sat Mar 21 07:24:02 EDT 2015System load: 0.43 Processes: 72Usage of /: 11.4% of 19.56GB Users logged in: 0Memory usage: 12% IP address for eth0: 45.55.134.248Swap usage: 0% IP address for docker0: 172.17.42.1Graph this data and manage this system at:https://landscape.canonical.com/root@dotesting:~# docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEbusybox latest 4986bf8c1536 11 weeks ago 2.433 MBroot@dotesting:~# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESb8a83077d858 busybox:latest "echo hello world" 4 minutes ago Exited (0) 4 minutes ago kickass_almeida root@dotesting:~# exitlogout$ |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $ docker-machine lsNAME ACTIVE DRIVER STATE URL SWARMdotesting * digitalocean Running tcp://45.55.134.248:2376 testing virtualbox Running tcp://192.168.99.100:2376 $ docker-machine stop dotesting$ docker-machine lsNAME ACTIVE DRIVER STATE URL SWARMdotesting * digitalocean Stopped tcp://45.55.134.248:2376 testing virtualbox Running tcp://192.168.99.100:2376 $ docker-machine rm dotesting$ docker-machine lsNAME ACTIVE DRIVER STATE URL SWARMtesting virtualbox Running tcp://192.168.99.100:2376 $ |
1 2 3 4 5 6 7 8 9 10 | $ brew install docker-compose==> Downloading https://homebrew.bintray.com/bottles/fig-1.1.0.yosemite.bottle.1.tar.gz<h6> ############################################################ 100.0%</h6>==> Pouring fig-1.1.0.yosemite.bottle.1.tar.gz==> CaveatsBash completion has been installed to:/usr/local/etc/bash_completion.d==> Summary/usr/local/Cellar/fig/1.1.0: 186 files, 2.2M$ |
1 2 3 4 5 6 7 | $ docker-machine create --driver virtualbox composeINFO[0001] Creating SSH key... INFO[0001] Creating VirtualBox VM... INFO[0007] Starting VirtualBox VM... INFO[0008] Waiting for VM to start... INFO[0041] "compose" has been created and is now the active machine. INFO[0041] To point your Docker client at it, run this in your shell: $(docker-machine env compose) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | web: image: russmckendrick/nginx-phpvolumes:- ./web:/var/www/html/ports:- 80:80environment:PHP_POOL: mywebsitelinks:- db:dbdb: image: russmckendrick/mariadbports:- 3306privileged: trueenvironment:MYSQL_ROOT_PASSWORD: wibbleMYSQL_DATABASE: wibbleMYSQL_USER: wibbleMYSQL_PASSWORD: wibble |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | $ docker exec -it example_web_1 bash[root@997bbe6b5c80 /]# ps auxUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.2 1.5 115200 15360 ? Ss 13:59 0:01 /usr/bin/python /usr/bin/supervisord -nroot 16 0.0 3.2 382876 33624 ? S 13:59 0:00 php-fpm: master process (/etc/php-fpm.conf)root 17 0.0 0.2 110016 2096 ? Ss 13:59 0:00 nginx: master process nginxnginx 18 0.0 0.5 110472 5568 ? S 13:59 0:00 nginx: worker processwebserv+ 19 0.0 1.5 383132 16284 ? S 13:59 0:00 php-fpm: pool mywebsitewebserv+ 20 0.0 0.8 382876 8848 ? S 13:59 0:00 php-fpm: pool mywebsitewebserv+ 21 0.0 0.8 382876 8848 ? S 13:59 0:00 php-fpm: pool mywebsitewebserv+ 22 0.0 0.8 382876 8848 ? S 13:59 0:00 php-fpm: pool mywebsitewebserv+ 23 0.0 0.8 382876 8852 ? S 13:59 0:00 php-fpm: pool mywebsiteroot 95 0.0 0.4 91540 4740 ? Ss 13:59 0:00 /usr/libexec/postfix/master -wpostfix 97 0.0 0.6 91712 6508 ? S 13:59 0:00 qmgr -l -t unix -upostfix 200 0.0 0.6 91644 6232 ? S 14:05 0:00 pickup -l -t unix -uroot 234 2.3 0.2 11748 2968 ? S 14:07 0:00 bashroot 250 1.0 1.1 110012 11616 ? S 14:07 0:00 nginxroot 251 0.0 0.2 19756 2212 ? R+ 14:07 0:00 ps aux[root@997bbe6b5c80 /]# exitexit$ |
警告:Swarm當前是beta版本,因此后期可能會(huì )有變化。我們還不推薦在生產(chǎn)環(huán)境中使用。現在讓我們使用Homebrew來(lái)安裝docker-swarm:
1 2 3 4 5 | $ brew install docker-swarm==> Downloading https://homebrew.bintray.com/bottles/docker-swarm-0.1.0.yosemite.bottle.tar.gz<h6> ############################################################ 100.0%</h6>==> Pouring docker-swarm-0.1.0.yosemite.bottle.tar.gz/usr/local/Cellar/docker-swarm/0.1.0: 4 files, 8.7M |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | $ docker-machine lsNAME ACTIVE DRIVER STATE URL SWARM$ docker-machine create -d virtualbox localINFO[0001] Creating SSH key... INFO[0001] Creating VirtualBox VM... INFO[0006] Starting VirtualBox VM... INFO[0006] Waiting for VM to start... INFO[0039] "local" has been created and is now the active machine. INFO[0039] To point your Docker client at it, run this in your shell: $(docker-machine env local) $ $(docker-machine env local) $ docker run swarm createUnable to find image 'swarm:latest' locally511136ea3c5a: Pull complete ae115241d78a: Pull complete f49087514537: Pull complete fff73787bd9f: Pull complete 97c8f6e912d7: Pull complete 33f9d1e808cf: Pull complete 62860d7acc87: Pull complete bf8b6923851d: Pull complete swarm:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.Status: Downloaded newer image for swarm:latest63e7a1adb607ce4db056a29b1f5d30cf$ |
1 2 3 4 5 6 7 8 9 10 11 12 13 | $ docker-machine create \→ -d virtualbox \→ --swarm \→ --swarm-master \→ --swarm-discovery token://63e7a1adb607ce4db056a29b1f5d30cf \→ swarm-masterINFO[0000] Creating SSH key... INFO[0000] Creating VirtualBox VM... INFO[0006] Starting VirtualBox VM... INFO[0006] Waiting for VM to start... INFO[0038] Configuring Swarm... INFO[0043] "swarm-master" has been created and is now the active machine. INFO[0043] To point your Docker client at it, run this in your shell: $(docker-machine env swarm-master) |
1 2 3 4 5 6 7 8 9 10 11 | $ docker-machine create \→ -d virtualbox \→ --swarm \→ --swarm-discovery token://63e7a1adb607ce4db056a29b1f5d30cf \→ swarm-node-00INFO[0000] Creating SSH key... INFO[0000] Creating VirtualBox VM... INFO[0006] Starting VirtualBox VM... INFO[0006] Waiting for VM to start... INFO[0039] Configuring Swarm... INFO[0048] "swarm-node-00" has been created and is now the active machine. |
1 2 3 4 5 6 7 8 | $ docker run -d --name redis1 -e affinity:image==redis redisaf66148bbbc8dcd799d82448dfd133b968d34eb7066a353108bf909ea3324a58$ docker run -d --name mysql -e affinity:image==mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql 70b2d93d6f83aa99f5ad4ebe5037e228a491a4b570609840f3f4be9780c33587$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES70b2d93d6f83 mysql:latest "/entrypoint.sh mysq 3 seconds ago Up Less than a second 3306/tcp swarm-node-00/mysql af66148bbbc8 redis:latest "/entrypoint.sh redi 2 minutes ago Up 2 minutes 6379/tcp swarm-master/redis1 |
1 2 3 4 5 6 | $ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES40f5fee257bb russmckendrick/nginx-php:latest "/usr/local/bin/run" 4 seconds ago Up Less than a second 192.168.99.101:80->80/tcp swarm-master/elated_einstein 2d066b2ccf28 russmckendrick/nginx-php:latest "/usr/local/bin/run" 8 seconds ago Up Less than a second 192.168.99.102:80->80/tcp swarm-node-00/drunk_mestorf 70b2d93d6f83 mysql:latest "/entrypoint.sh mysq 26 minutes ago Up 26 minutes 3306/tcp swarm-node-00/mysql af66148bbbc8 redis:latest "/entrypoint.sh redi 29 minutes ago Up 29 minutes 6379/tcp swarm-master/redis1 |
聯(lián)系客服