LoginSignup
4
4

More than 5 years have passed since last update.

MacOSX LionでDocker環境構築

Last updated at Posted at 2015-02-20

--

Boot2Docker for Mac OS X をインストール

公式ドキュメント(https://docs.docker.com/installation/mac/) 参照。

VirtualBoxをインストールしておく

次の手順でVirtualBox内にboot2docker-vmが作られる。

Boot2Dockerの初期化

$ boot2docker init

Latest release for boot2docker/boot2docker is v1.5.0
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download/v1.5.0/boot2docker.iso
    to /Users/a12047/.boot2docker/boot2docker.iso

Boot2Dockerを起動

$ boot2docker start

Waiting for VM and Docker daemon to start………ooooooooooooooooo
Started.
Writing /Users/a12047/.boot2docker/certs/   boot2docker-vm/ca.pem
Writing /Users/a12047/.boot2docker/certs/   boot2docker-vm/cert.pem
Writing /Users/a12047/.boot2docker/certs/boot2docker-vm/key.pem

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

(自分の場合のみ)

$ docker version

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): darwin/amd64
FATA[0032] An error occurred trying to connect: Get https://192.168.59.103:2376/v1.17/version: dial tcp 192.168.59.103:2376: i/o timeout

のようにFATA[0032] 〜 i/o timeout が出る。
自Macのルーティング問題と思われ。
(参考:http://stackoverflow.com/questions/26686358/docker-cant-connect-to-boot2docker-because-of-tcp-timeout)

$ ifconfig -a

「192.168.59.3」のinterface名を確認(自分はvboxnet3だった)

ルーティング追加
$ sudo route -nv add -net 192.168.59 -interface vboxnet3

再度チェック
$ docker version

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): darwin/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

エラーなくなった♪


Boot2Dockerを停止

$ boot2docker stop

boot2dockerコマンドオプションを見てみる

$ boot2docker help

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4