LoginSignup
3
3

More than 5 years have passed since last update.

Mac OS XでDocker

Last updated at Posted at 2015-06-25

MacにDockerインストール

1. VirtualBoxのインストール

事前にVirtualBoxのインストールが必要です。
https://www.virtualbox.org/
こちらのサイトからVirtualBoxをインストール

2. boot2docker

boot2dockerをインストール
brew install boot2docker

VM作成
boot2docker init

VM起動
boot2docker start

以下のコマンドで設定すべき環境変数が確認できます。
boot2docker shellinit

環境設定コマンドを実行
$(boot2docker shellinit)

※.bashrcに以下を追記しておけばOK。

.bashrc
# Docker
eval $(boot2docker shellinit)

hello-world コンテナを起動して、確認。
Hello from Docker.が表示される。
docker run hello-world

こんな時は?

docker.sock: no such file or directory

FATA[0000] Get http:///var/run/docker.sock/v1.18/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

環境設定コマンドが上手くいってない?環境設定コマンドを実行してみる。
$(boot2docker shellinit)

x509: certificate is valid

FATA[0000] An error occurred trying to connect: Post https://192.168.59.103:2376/v1.18/containers/create: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103

boot2dockerを再作成
1度deleteして
boot2docker delete

再度VM作成
boot2docker init

3
3
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
3
3