LoginSignup
1
2

More than 5 years have passed since last update.

Get Started with Docker for Mac OS X (初心者)

Last updated at Posted at 2016-05-22

dockerがMacに対応したとの事で、重い腰を上げて触ってみました。
この記事では、Docker Toolboxをインストールして、動作確認までの流れを記載しています。

環境

  • MacBook Air(13-inch, Mid 2012)
  • OS X El Captian
  • Docker Toolbox 1.11.1b

Step 1: OSバージョンのチェック

こちらにもあるように、Moutain Lion以上のバーションである必要があるので、チェックします。

Step 2: Docker Toolboxのインストール

Install Docker Toolbox on Mac OS Xにそってインストール。
Docker Toolboxのリンクからインストーラーをダウンロードする。
ダウンロードしたら、パッケージファイルを選択します。
そうすると下記の様なダイアログボックスが表示されるので、Continueを選択します。

システム要件などを満たしていると、Docker Toolbox Installが立ち上がるので、どんどんいきましょう。

ここも、Continueをクリックします。

インストールされるものは、

  • Dockerのクライアント
  • Docker Machine
  • Docker Compose
  • GUIクライアント
  • Docker Quickstart Terminal app

です。1

また、今後の開発の為に、データが送られても構わないよ、という方は
「Help Docker improve Toolbox」よ項目にチェックを入れてContinueをクリックします。

インストール先を確認したら、Installをクリックします。

しばらくすると、、、

上記のアプリケーションから、Dockerを始める事ができるみたいです。
記載通り、Applicationディレクトリに該当アプリが格納されます。

これで、インストールは完了です。

Step:3 インストールの確認作業

今回は、公式のドキュメントでも記載されている「Docker Quickstart Terminal app」での方法を選択しました。

1.Launchpadから「Docker Quickstart Terminal」を選択します。
2.使用するターミナルアプリを選択します。

3.アプリをクリックすると、勝手に色々してくれます。こんな感じです。(約5分間まつ、、)

Last login: Sat May 21 18:56:01 on ttys002
bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
☁  ~  bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
Creating CA: /Users/mfks17/.docker/machine/certs/ca.pem
Creating client certificate: /Users/mfks17/.docker/machine/certs/cert.pem
Running pre-create checks...
Creating machine...
(default) Copying /Users/mfks17/.docker/machine/cache/boot2docker.iso to /Users/mfks17/.docker/machine/machines/default/boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Found a new host-only adapter: "vboxnet2"
(default) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: /usr/local/bin/docker-machine env default


                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/


docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com

☁  ~

4.次にdocker run hello-worldとターミナルにタイプしてリターンキーを押します。

このコマンドも、いろいろやってくれる感じです。

☁  ~  docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

4276590986f6: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:4f32210e234b4ad5cac92efacc0a3d602b02476c754f13d517e1ada048e5a8ba
Status: Downloaded newer image for hello-world:latest

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

☁  ~

感想

特にハマらずにいけました。
Macに対応したことによって、インストール周りのインフラが整う事は、初学者が入りやすくとても良いと思います。

謝辞


  1. 本家ページと比べて若干UI変わってますね。 

1
2
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
1
2