2018/06/10

Docker Universal Control Plane を CentOS7 で起動してみる

前回の記事では CentOS7 に Docker EE を入れました
さて、何故入れたかと言えば Docker Universal Control Plane(UCP) を使ってみたかったからです。

Unix User を dockergroup に所属させることで、複数のユーザが root でなくても docker を利用できます。
しかし、他人が run した container に attach 可能。場合によってはよろしくない。
何か解決策が無いかと調べたところ UCP を見付けました。

UCP には Permission Control があって、Full Control の権限をユーザに与えても
The user can view and edit volumes, networks, and images, They can create containers without any restriction, but can't see other users' containers.
とのことで、別のユーザのコンテナは見られない。
なので、root でない複数ユーザが、相互に干渉せず docker を使えそうです。


環境

  • OS: CentOS Linux release 7.4.1708 (Core)
  • Kernel: 3.10.0-693.5.2.el7.x86_64
  • Docker: docker-ee-17.03.0.ee.1-1.el7.centos.x86_64
  • Docker Universal Control Plane: 2.2.6


run UCP

公式の document に従って UCP のイメージを run します。
  • $ docker image pull docker/ucp:2.2.6
  • $ docker container run --rm -it --name ucp -v /var/run/docker.sock:/var/run/docker.sock docker/ucp:2.2.6 install --host-address 127.0.0.1 --interactive
    • --interactive が付いてるので適宜入力します
    • 具体的には Admin username や password とかですね
さてこれで起動……しません。
INFO[0000] Initializing a new swarm at 127.0.0.1     
FATA[0034] the following required ports are blocked on your host: 12385, 12376, 12383, 443, 12384, 12379, 12387, 12386, 12381, 12382, 2376, 12380.  Check your firewall settings 
と言われました。おお、結構な数の port 使うな。

ということで firewall に穴を開けます。
  • # for i in 12376 4789 12386 2376 443 12381 12380 12382 12383 12384 12385 12379 12387 ; firewall-cmd --add-port=$i/tcp --permanent
  • # firewall-cmd --reload
くらいかな。

そして再度 run してみる。今度は
FATA[0031] The following required ports are already in use on your host - 2377.  You may specify an alternative port number to 2377 with the --swarm-port argument.
と言われた。あれ。何が 2377 使ってるんだ?
  • $ netstat -lntp
すると確かに 2377 が listen になってる。 process name は dockerd か。

結論から言うと、一回目で起動した swarm が生きてたのが原因でした。なので
  • $ docker swarm leave --force
して抜ける。さて三度目のトライ。コマンドは変わらず
  • $ docker run -it --rm --name ucp -v /var/run/docker.sock:/var/run/docker.sock docker/ucp:2.2.6 install --interactive
で実行します。お、起動したっぽいですね。三度目の正直。
INFO[0007] Generating UCP Client Root CA
INFO[0007] Deploying UCP Service
INFO[0035] Installation completed on raven (node abcdefghijklmnopqrstuvwxy)
...
INFO[0035] Login to UCP at https://127.0.0.1:443
https//127.0.0.1 にアクセスすると UCP の画面が出てきました。ログインも可能。良し良し。


参考

0 件のコメント:

コメントを投稿