by shigemk2

当面は技術的なことしか書かない

Dockerを使ってみたけどVagrantのほうが便利な気がしたという小並感

$  boot2docker init
boot2docker-vm Virtual Box vm already exists
$  boot2docker init
[2014-02-10 19:23:35] Creating VM boot2docker-vm
Virtual machine 'boot2docker-vm' is created and registered.
UUID: 13f420d5-6c4f-4b27-a81a-1aec50fad6a8
Settings file: '/Users/shige/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox'
[2014-02-10 19:23:35] Setting VM settings
[2014-02-10 19:23:35] Setting VM networking
[2014-02-10 19:23:35] boot2docker.iso not found.
[2014-02-10 19:23:37] Latest version is v0.5.4, downloading...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   344  100   344    0     0    340      0  0:00:01  0:00:01 --:--:--   340
100 27.0M  100 27.0M    0     0   899k      0  0:00:30  0:00:30 --:--:-- 1602k
[2014-02-10 19:24:07] Done
[2014-02-10 19:24:07] Setting VM disks
[2014-02-10 19:24:08] Creating 40000 Meg hard drive...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Disk image created. UUID: 9f4a6975-52df-4d29-a8c1-b5e7cb52fc0d
Converting from raw image file="format-flag.txt" to file="format-flag.vmdk"...
Creating dynamic image with size 5242880 bytes (5MB)...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VMDK'. UUID: 9f4a6975-52df-4d29-a8c1-b5e7cb52fc0d
[2014-02-10 19:24:09] Done.
[2014-02-10 19:24:09] You can now type boot2docker up and wait for the VM to start.
$  boot2docker up
[2014-02-10 19:24:39] Starting boot2docker-vm...
[2014-02-10 19:24:59] Started.
$  boot2docker ssh
Warning: Permanently added '[localhost]:2022' (RSA) to the list of known hosts.
docker@localhost's password:
Permission denied, please try again.
docker@localhost's password:
Permission denied, please try again.
docker@localhost's password:
Received disconnect from 127.0.0.1: 2: Too many authentication failures for docker
$  boot2docker ssh
Warning: Permanently added '[localhost]:2022' (RSA) to the list of known hosts.
docker@localhost's password:
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
boot2docker: 0.5.4
docker@boot2docker:~$ exit
Connection to localhost closed.
$  boot2docker ssh
Warning: Permanently added '[localhost]:2022' (RSA) to the list of known hosts.
docker@localhost's password:
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
boot2docker: 0.5.4
docker@boot2docker:~$ uname -a
Linux boot2docker 3.12.1-tinycore64 #1 SMP Fri Jan 10 13:04:04 UTC 2014 x86_64 GNU/Linux
docker@boot2docker:~$ exit
Connection to localhost closed.
$  export DOCKER_HOST=tcp://
$  docker info
Containers: 0
Images: 0
Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Dirs: 0
Debug mode (server): true
Debug mode (client): false
Fds: 10
Goroutines: 12
Execution Driver: lxc-0.8.0
EventsListeners: 0
Kernel Version: 3.12.1-tinycore64
Init Path: /usr/local/bin/docker
$  sudo docker run ubuntu /bin/echo hello world
2014/02/10 19:26:45 dial unix /var/run/docker.sock: no such file or directory
$  sudo docker pull ubuntu
2014/02/10 19:26:54 dial unix /var/run/docker.sock: no such file or directory
$  docker pull ubuntu
Pulling repository ubuntu
9cd978db300e: Download complete
9cc9ea5ea540: Download complete
9f676bd305a4: Download complete
eb601b8965b8: Download complete
5ac751e8d623: Download complete
511136ea3c5a: Download complete
1c7f181e78b9: Download complete
f323cf34fd77: Download complete
7a4f87241845: Download complete
6170bb7b0ad1: Download complete
321f7f4200f4: Download complete
$   docker run ubuntu /bin/echo hello world
hello world

docker pullにすごい時間がかかった。たぶん30分くらい。

vagrant box add のほうが圧倒的に早い。2、3分で終わるし。

Requirements and Installation on Mac OS X 10.6 Snow Leopard - Docker Documentation