带web界面的Docker管理平台shipyard

Shipyard 是一个管理容器、主机等资源的web图形化工具,它建立在docker集群管理工具Citadel之上。有core和extension两个版本:

类型 功能
core 把多个Docker host上的 containers 统一管理,支持跨越多个host。
extension 添加了应用路由和负载均衡、集中化日志、部署等功能。

engine

一个shipyard管理的docker集群可以包含一个或多个engine,一个engine就是监听tcp端口的docker daemon。shipyard管理docker daemon、images、containers完全基于Docker API,不需要做其他的修改。另外,shipyard可以对每个engine做资源限制,包括CPU和内存;因为TCP监听相比Unix socket方式会有一定的安全隐患,所以shipyard还支持通过SSL证书与docker后台进程安全通信。

rethinkdb

RethinkDB是一个shipyard项目的一个docker镜像,用来存放账号(account)、引擎(engine)、服务密钥(service key)、扩展元数据(extension metadata)等信息,但不会存储任何有关容器或镜像的内容。一般会启动一个shipyard/rethinkdb容器shipyard-rethinkdb-data来使用它的/data作为数据卷供另外rethinkdb一个挂载,专门用于数据存储。

搭建

修改配置文件

vim /etc/sysconfig/docker

#修改other_args值
other_args="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock"

#重启docker后查看端口
netstat -plt | grep 4243

启动rethinkdb

docker pull shipyard/shipyard


docker run -it -d --name shipyard-rethinkdb-data \
--entrypoint /bin/bash shipyard/rethinkdb -l

docker run -it -P -d --name shipyard-rethinkdb \
--volumes-from shipyard-rethinkdb-data shipyard/rethinkdb

docker run -it -p 8080:8080 -d --name shipyard \
--link shipyard-rethinkdb:rethinkdb shipyard/shipyard

URL         http://<your-host-ip>:8080
USER        admin
PASSSWORD   shipyard

shipyard-cli

图形界面没有提供修改密码的功能,不过可以通过shipyard-cli来修改。

docker run -ti --rm shipyard/shipyard-cli

docker run -it shipyard/shipyard-cli

#执行shipyard-cli后,通过下面的命令查看更多功能
shipyard cli> shipyard help
NAME:
   shipyard - manage a shipyard cluster

USAGE:
   shipyard [global options] command [command options] [arguments...]

VERSION:
   2.0.8

COMMANDS:
   login        login to a shipyard cluster
   change-password  update your password
   accounts     show accounts
   add-account      add account
   delete-account   delete account
   containers       list containers
   inspect      inspect container
   run          run a container
   stop         stop a container
   restart      restart a container
   scale        scale a container
   logs         show container logs
   destroy      destroy a container
   engines      list engines
   add-engine       add shipyard engine
   remove-engine    removes an engine
   inspect-engine   inspect an engine
   service-keys     list service keys
   add-service-key  adds a service key
   remove-service-key   removes a service key
   extensions       show extensions
   add-extension    add extension
   remove-extension remove an extension
   webhook-keys     list webhook keys
   add-webhook-key  adds a webhook key
   remove-webhook-key   removes a webhook key
   info         show cluster info
   events       show cluster events
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h           show help
   --generate-bash-completion   
   --version, -v        print the version   

修改密码

shipyard cli> shipyard login
URL: http://<服务器IP>:8080
Username: admin
Password: shipyard

shipyard cli> shipyard change-password
Password: 新密码
Confirm: 验证密码