Dockerをためしてみるの巻

MacでDocker試したいのです。Oracleを入れて動作確認出来ればと思ってます。

結果

  • MacにDocker入れてOracle動かすことが出来た
  • Dockerイメージのダウンロードに時間がかかったぐらいで、特に難しいところはなし
  • SQLDeveloperからOracle on Dockerに接続出来る
  • 複雑なインストール必要ないのはメリット
  • Docker終了すると作成した表とかが失われるはず(?)なので、情報の保持の仕方については検討する必要あり
  • 直接インストールするのと比べて何が出来なくなっているか、どのような制約があるのかは分かってない

Docker for Mac

情報元

インストール手順

  1. Stable Channelをダウンロード
  2. https://docs.docker.com/docker-for-mac/install/#what-to-know-before-you-install
  3. Docker.dmgを実行
  4. ApplicationフォルダにDocker.appをコピー
  5. Docker.appをダブルクリック
  6. Docker実行
  7. ターミナルで以下確認
➜  ~ docker version 
Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Tue Mar 28 00:40:02 2017
 OS/Arch:      darwin/amd64
Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:00:50 2017
 OS/Arch:      linux/amd64
 Experimental: true
  • ついでにもう少し確認してみる。
➜  ~ docker --version
Docker version 17.03.1-ce, build c6d412e
➜  ~ docker-compose --version
docker-compose version 1.11.2, build dfed245
➜  ~ docker-machine --version
docker-machine version 0.10.0, build 76ed2a6
  • docker runしてみる
➜  ~ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete 
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
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 ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

最初はhello-worldのイメージが見つからない。 その後、searchが実行され、Hitした場合はダウンロードされている。

Oracle11g on Docker for Mac

  • Dockerイメージの取得
➜  ~ docker pull wnameless/oracle-xe-11g
Using default tag: latest
latest: Pulling from wnameless/oracle-xe-11g
8aec416115fd: Pull complete 
695f074e24e3: Pull complete 
946d6c48c2a7: Pull complete 
bc7277e579f0: Pull complete 
2508cbcde94b: Pull complete 
0f39b2269587: Pull complete 
72a6f16c5b79: Pull complete 
Digest: sha256:e19b086b2d96325a4473d1a9cf44b9d8273b259c34b86d54e5c92452ac97ba54
Status: Downloaded newer image for wnameless/oracle-xe-11g:latest

えらい時間かかったが出来た。

  • Dockerイメージの確認
➜  ~ docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
wnameless/oracle-xe-11g   latest              51fad6f11394        3 months ago        2.24 GB
hello-world               latest              48b5124b2768        4 months ago        1.84 kB

Oracleで約2GB!?

➜  ~ docker run -d -p 49160:22 -p 49161:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g
9d1fb7238ab2125d307d7cf504077d371864a022c68a6664d7a97114e916e56e
  • SQLDeveloperからの接続

以下Readmeに接続情報とか記載されています。

github.com