m_shige1979のときどきITブログ

プログラムの勉強をしながら学習したことや経験したことをぼそぼそと書いていきます

Github(変なおっさんの顔でるので気をつけてね)

https://github.com/mshige1979

macにBoot2Dockerをインストールしてみた

vagrantとかの環境でも

いいけどmacから直でもいいよね。windowsではダメだったし

インストール環境

MBA
VirtualBox5.0.8?

インストールするもの

Boot2Docker

手順

ダウンロード

f:id:m_shige1979:20151107130541p:plain
http://boot2docker.io/

インストールを行う

f:id:m_shige1979:20151107130645p:plain

インストール完了

f:id:m_shige1979:20151107130740p:plain

コマンド確認
$ which boot2docker
/usr/local/bin/boot2docker
$
$ boot2docker -v
Boot2Docker-cli version: v1.8.0
Git commit: 9a26066
Usage: boot2docker [<options>] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|shellinit|delete|download|upgrade|version} [<args>]
$
起動
$ boot2docker init

  WARNING: The 'boot2docker' command line interface is officially deprecated.

  Please switch to Docker Machine (https://docs.docker.com/machine/) ASAP.

  Docker Toolbox (https://docker.com/toolbox) is the recommended install method.

Latest release for github.com/boot2docker/boot2docker is v1.9.0
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download/v1.9.0/boot2docker.iso
	to /Users/matsumotoshigeharu/.boot2docker/boot2docker.iso
Generating public/private rsa key pair.
Your identification has been saved in /xxx/.ssh/id_boot2docker.
Your public key has been saved in /xxx/.ssh/id_boot2docker.pub.
The key fingerprint is:
-------------------------------
いろいろなキーが出た
-------------------------------
Initialization of virtual machine "boot2docker-vm" complete.
Use `boot2docker up` to start it.
$ boot2docker up

  WARNING: The 'boot2docker' command line interface is officially deprecated.

  Please switch to Docker Machine (https://docs.docker.com/machine/) ASAP.

  Docker Toolbox (https://docker.com/toolbox) is the recommended install method.

Waiting for VM and Docker daemon to start...
.........................ooooooooooo
Started.
Writing /xxx/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /xxx/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /xxx/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_TLS_VERIFY=1
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/xxx/.boot2docker/certs/boot2docker-vm

Or run: `eval "$(boot2docker shellinit)"`

$
起動確認
$ boot2docker status
running
$
環境変数を追加
$ echo 'export DOCKER_TLS_VERIFY=1' >> ~/.bash_profile
$ echo 'export DOCKER_HOST=tcp://192.168.59.103:2376' >> ~/.bash_profile
$ echo 'export DOCKER_CERT_PATH=/xxx/.boot2docker/certs/boot2docker-vm' >> ~/.bash_profile
$
環境変数の確認
$ env | grep DOCKER
DOCKER_HOST=tcp://192.168.59.103:2376
DOCKER_TLS_VERIFY=1
DOCKER_CERT_PATH=/xxx/.boot2docker/certs/boot2docker-vm
$
バージョンの確認
$ docker version
Client:
 Version:      1.8.0
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   0d03096
 Built:        Tue Aug 11 17:17:40 UTC 2015
 OS/Arch:      darwin/amd64

Server:
 Version:      1.9.0
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   76d6bc9
 Built:        Tue Nov  3 19:20:09 UTC 2015
 OS/Arch:      linux/amd64
$

とりあえずここまで
redmineを作ってみようとしたけどcomposeとかなんとかでうまくいかない
webサーバとmysqlなどのデータベースサーバをどのように管理するかを検討しないといけないかも…

Note: This release of Docker deprecates the Boot2Docker command line in favor of Docker Machine. Use the Docker Toolbox to install Docker Machine as well as the other Docker tools.

もう古いのかDocker Toolboxに入れろとか言われているような気が…