Docker运维笔记四:Docker安装shipyard

安装shipyard前提是已安装好Docker,详见【Linux安装笔记九:Linux服务器安装Docker】,本次使用操作系统依然是CentOS7

前言

shipyard安装参照官网 https://shipyard-project.com/deploy/ 有两种方式:
1、自动安装,即执行curl -sSL https://shipyard-project.com/deploy | bash -s命令即可,但是放到Linux下执行根本跑不通。
2、手动安装,本文使用手动安装的方式,具体步骤如下:

1、下载所需docker镜像
docker pull rethinkdb
docker pull microbox/etcd
docker pull shipyard/docker-proxy
docker pull swarm
docker pull dockerclub/shipyard
2、修改原安装脚本为中文版安装脚本

注:此步骤两个下载脚本的链接都不好用,终于在网上找到了一个脚本使用,命名为shipyard-deploy,上传到/home/script文件夹下

#下载官方脚本
wget https://shipyard-project.com/deploy
若下载失败请使用
wget https://raw.githubusercontent.com/shipyard/shipyard-project.com/master/site/themes/shipyard/static/deploy

#替换官方脚本 
grep -n shipyard:latest deploy
sed -i 's/shipyard\/shipyard:latest/dockerclub\/shipyard:latest/g' deploy

或者找到shipyard-deploy脚本里的shipyard/shipyard:latest改成dockerclub/shipyard:latest就行

3、设置web访问端口(根据需要修改)

方式一:

#检查8080端口是否被占用,若占用需修改端口
yum install -y net-tools    //安装net-tools工具包,若已安装可跳过此步骤
netstat -tlnp | grep 8080   //查看宿主机8080端口是否被占用
#配置修改
grep -n 'PORT:-8080' deploy
SHIPYARD_PORT=${PORT:-8080}
修改为
SHIPYARD_PORT=${PORT:-指定端口}

方式二:直接修改脚本文件
代理端口(PROXY_PORT)改为12375
WEB端口(SHIPYARD_PORT)改为18080

图片.png

4、安装与删除
cd /home/script
#安装 启动
sh shipyard-deploy              
#删除 停止                     
cat shipyard-deploy | ACTION=remove bash 

启动成功提示:

[root@localhost script]# sh shipyard-deploy
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
c9b1b535fdd9: Pulling fs layer
c9b1b535fdd9: Verifying Checksum
c9b1b535fdd9: Download complete
c9b1b535fdd9: Pull complete
Digest: sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
Status: Downloaded newer image for alpine:latest
Deploying Shipyard
 -> Starting Database
 -> Starting Discovery
 -> Starting Cert Volume
 -> Starting Proxy
 -> Starting Swarm Manager
 -> Starting Swarm Agent
 -> Starting Controller
Waiting for Shipyard on 192.168.197.91:18080

查看验证是否安装或删除

docker ps
5、使用shipyard
浏览器输入:http://主机IP:8080
默认账号:admin
默认密码:shipyard
图片.png
6、shipyard添加其他节点主机

比如将172.16.60.220机器节点加入到上面的shipyard管理中.
则需要在被加入节点机器上如下操作:

  1. 在被加入的节点上上传脚本文件shipyard-deploy
  2. 执行下面操作 (注意下面etcd地址要写成shipyard部署机的ip地址. 首次执行时会自动下载镜像,需要等待一段时间)
cat shipyard-deploy| ACTION=node DISCOVERY=etcd://192.168.197.91:4001 bash

Adding Node
 -> Starting Cert Volume
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine

-> Starting Swarm Agent
Node added to Swarm: 192.168.3.142

查看安装好的shipyard docker ps

注意:添加节点时,上面一键脚本需要运行在被添加的节点主机上,而不是shipyard部署节点的机器上。

然后登录http://192.168.3.141:18080,在"容器管理"-"主机节点"中看到添加的节点信息了.

7、删除节点机
cat shipyard-deploy |ACTION=remove bash -s

验证是否删除成功docker ps

8、遇到问题

1、shipyard可以启动访问,但是刷新不出容器,镜像

解决:因为我们修改了代理端口(PROXY_PORT)改为12375,需要配置防火墙开启此端口,

firewall-cmd --zone=public --add-port=12375/tcp --permanent  
firewall-cmd --reload

或者关闭防火墙,重启Docker systemctl restart docker就好了

你可能感兴趣的:(Docker运维笔记四:Docker安装shipyard)