参考了多篇csdn博文,大致都说要执行
curl -sSL https://shipyard-project.com/deploy| bash -s
但并未成功,此页面也没有安装脚本,最后安装官网上手动部署的说明安装成功了,页面用户名是admin,密码是shipyard
[root@warship ~]# docker run -ti -d --restart=always --name shipyard-rethinkdb rethinkdb 030114ffb47627e3bec9edbba5c85ee660cae0f9b6c3ce5e6bd16 [root@warship ~]# docker run -ti -d -p 4001:4001 -p 7001:7001 --restart=always --name shipyard-discovery microbox/etcd:latest -name discovery 445df52ea566df4098cf6010c7a78be2930bd4cfb7d339d21af20e373b [root@warship ~]# docker run -ti -d -p 2375:2375 --hostname=$HOSTNAME --restart=always --name shipyard-proxy \ > -v /var/run/docker.sock:/var/run/docker.sock -e PORT=2375 shipyard/docker-proxy:latest bbc56910e007e52033a45c4c0de9d4e62d5d641d00f901c386c1c00bd [root@warship ~]# docker run -ti -d --restart=always --name shipyard-swarm-manager swarm:latest manage \ > --host tcp://0.0.0.0:3375 etcd://192.168.238.130:4001 cadb2fa8f9efb4c8a9e2e9469bc0170d058fbfdb8f17ce8c1de [root@warship ~]# docker run -ti -d --restart=always --name shipyard-swarm-agent swarm:latest \ > join --addr 192.168.238.130:2375 etcd://192.168.238.130:4001 651b2d3bc4b9fb36ee0ee0b7db0f7f053a3832c888cf54bcf314af934 [root@warship ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 651b2d3bc4b9 swarm:latest "/swarm join --addr …" 16 seconds ago Up 15 seconds 2375/tcp shipyard-swarm-agent cadb2f swarm:latest "/swarm manage --hos…" 54 seconds ago Up 53 seconds 2375/tcp shipyard-swarm-manager 6d582cc4e46b shipyard/shipyard:latest "/bin/controller ser…" 4 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp shipyard-controller bbc56910e007 shipyard/docker-proxy:latest "/usr/local/bin/run" 5 minutes ago Up 5 minutes 0.0.0.0:2375->2375/tcp shipyard-proxy 445df52ea566 microbox/etcd:latest "/bin/etcd -name dis…" 6 minutes ago Up 6 minutes 0.0.0.0:4001->4001/tcp, 0.0.0.0:7001->7001/tcp shipyard-discovery 030114ffb476 rethinkdb "rethinkdb --bind all" 6 minutes ago Up 6 minutes 8080/tcp, 28015/tcp, 29015/tcp shipyard-rethinkdb
但是这样操作后访问页面看不到任何容器与镜像,也失败了。
解决办法
1、如果打开了docker remote api的2375端口,要关闭
2、在网上找到了正式的安装脚本
[root@warship ~]# cat shipyard-deploy #!/bin/bash # Author : Zlyang By 2018-09-07 # Description : Auto deploy shipyard # Email : if [ "$1" != "" ] && [ "$1" = "-h" ]; then echo "Shipyard Deploy uses the following environment variables:" echo " ACTION: this is the action to use (deploy, upgrade, node, remove)" echo " DISCOVERY: discovery system used by Swarm (only if using 'node' action)" echo " IMAGE: this overrides the default Shipyard image" echo " PREFIX: prefix for container names" echo " SHIPYARD_ARGS: these are passed to the Shipyard controller container as controller args" echo " TLS_CERT_PATH: path to certs to enable TLS for Shipyard" echo " PORT: specify the listen port for the controller (default: 8080)" echo " IP: specify the address at which the controller or node will be available (default: eth0 ip)" echo " PROXY_PORT: port to run docker proxy (default: 2375)" exit 1 fi if [ -z "`which docker`" ]; then echo "You must have the Docker CLI installed on your \$PATH" echo " See http://docs.docker.com for details" exit 1 fi ACTION=${ACTION:-deploy} IMAGE=${IMAGE:-dockerclub/shipyard:latest} PREFIX=${PREFIX:-shipyard} SHIPYARD_ARGS=${SHIPYARD_ARGS:-""} TLS_CERT_PATH=${TLS_CERT_PATH:-} CERT_PATH="/etc/shipyard" PROXY_PORT=${PROXY_PORT:-2375} SWARM_PORT=3375 SHIPYARD_PROTOCOL=http SHIPYARD_PORT=${PORT:-8080} SHIPYARD_IP=${IP} DISCOVERY_BACKEND=etcd DISCOVERY_PORT=4001 DISCOVERY_PEER_PORT=7001 ENABLE_TLS=0 CERT_FINGERPRINT="" LOCAL_CA_CERT="" LOCAL_SSL_CERT="" LOCAL_SSL_KEY="" LOCAL_SSL_CLIENT_CERT="" LOCAL_SSL_CLIENT_KEY="" SSL_CA_CERT="" SSL_CERT="" SSL_KEY="" SSL_CLIENT_CERT="" SSL_CLIENT_KEY="" show_cert_help() { echo "To use TLS in Shipyard, you must have existing certificates." echo "The certs must be named ca.pem, server.pem, server-key.pem, cert.pem and key.pem" echo "If you need to generate certificates, see https://github.com/ehazlett/certm for examples." } check_certs() { if [ -z "$TLS_CERT_PATH" ]; then return fi if [ ! -e $TLS_CERT_PATH ]; then echo "Error: unable to find certificates in $TLS_CERT_PATH" show_cert_help exit 1 fi if [ "$PROXY_PORT" = "2375" ]; then PROXY_PORT=2376 fi SWARM_PORT=3376 SHIPYARD_PROTOCOL=https LOCAL_SSL_CA_CERT="$TLS_CERT_PATH/ca.pem" LOCAL_SSL_CERT="$TLS_CERT_PATH/server.pem" LOCAL_SSL_KEY="$TLS_CERT_PATH/server-key.pem" LOCAL_SSL_CLIENT_CERT="$TLS_CERT_PATH/cert.pem" LOCAL_SSL_CLIENT_KEY="$TLS_CERT_PATH/key.pem" SSL_CA_CERT="$CERT_PATH/ca.pem" SSL_CERT="$CERT_PATH/server.pem" SSL_KEY="$CERT_PATH/server-key.pem" SSL_CLIENT_CERT="$CERT_PATH/cert.pem" SSL_CLIENT_KEY="$CERT_PATH/key.pem" CERT_FINGERPRINT=$(openssl x509 -noout -in $LOCAL_SSL_CERT -fingerprint -sha256 | awk -F= '{print $2;}') if [ ! -e $LOCAL_SSL_CA_CERT ] || [ ! -e $LOCAL_SSL_CERT ] || [ ! -e $LOCAL_SSL_KEY ] || [ ! -e $LOCAL_SSL_CLIENT_CERT ] || [ ! -e $LOCAL_SSL_CLIENT_KEY ]; then echo "Error: unable to find certificates" show_cert_help exit 1 fi ENABLE_TLS=1 } # container functions start_certs() { ID=$(docker run \ -ti \ -d \ --restart=always \ --name $PREFIX-certs \ -v $CERT_PATH \ alpine \ sh) if [ $ENABLE_TLS = 1 ]; then docker cp $LOCAL_SSL_CA_CERT $PREFIX-certs:$SSL_CA_CERT docker cp $LOCAL_SSL_CERT $PREFIX-certs:$SSL_CERT docker cp $LOCAL_SSL_KEY $PREFIX-certs:$SSL_KEY docker cp $LOCAL_SSL_CLIENT_CERT $PREFIX-certs:$SSL_CLIENT_CERT docker cp $LOCAL_SSL_CLIENT_KEY $PREFIX-certs:$SSL_CLIENT_KEY fi } remove_certs() { docker rm -fv $PREFIX-certs > /dev/null 2>&1 } get_ip() { if [ -z "$SHIPYARD_IP" ]; then SHIPYARD_IP=`docker run --rm --net=host alpine ip route get 8.8.8.8 | awk '{ print $7; }'` fi } start_discovery() { get_ip ID=$(docker run \ -ti \ -d \ -p 4001:4001 \ -p 7001:7001 \ --restart=always \ --name $PREFIX-discovery \ microbox/etcd:latest -addr $SHIPYARD_IP:$DISCOVERY_PORT -peer-addr $SHIPYARD_IP:$DISCOVERY_PEER_PORT) } remove_discovery() { docker rm -fv $PREFIX-discovery > /dev/null 2>&1 } start_rethinkdb() { ID=$(docker run \ -ti \ -d \ --restart=always \ --name $PREFIX-rethinkdb \ rethinkdb) } remove_rethinkdb() { docker rm -fv $PREFIX-rethinkdb > /dev/null 2>&1 } start_proxy() { TLS_OPTS="" if [ $ENABLE_TLS = 1 ]; then TLS_OPTS="-e SSL_CA=$SSL_CA_CERT -e SSL_CERT=$SSL_CERT -e SSL_KEY=$SSL_KEY -e SSL_SKIP_VERIFY=1" fi # Note: we add SSL_SKIP_VERIFY=1 to skip verification of the client # certificate in the proxy image. this will pass it to swarm that # does verify. this helps with performance and avoids certificate issues # when running through the proxy. ultimately if the cert is invalid # swarm will fail to return. ID=$(docker run \ -ti \ -d \ -p $PROXY_PORT:$PROXY_PORT \ --hostname=$HOSTNAME \ --restart=always \ --name $PREFIX-proxy \ -v /var/run/docker.sock:/var/run/docker.sock \ -e PORT=$PROXY_PORT \ --volumes-from=$PREFIX-certs $TLS_OPTS\ shipyard/docker-proxy:latest) } remove_proxy() { docker rm -fv $PREFIX-proxy > /dev/null 2>&1 } start_swarm_manager() { get_ip TLS_OPTS="" if [ $ENABLE_TLS = 1 ]; then TLS_OPTS="--tlsverify --tlscacert=$SSL_CA_CERT --tlscert=$SSL_CERT --tlskey=$SSL_KEY" fi EXTRA_RUN_OPTS="" if [ -z "$DISCOVERY" ]; then DISCOVERY="$DISCOVERY_BACKEND://discovery:$DISCOVERY_PORT" EXTRA_RUN_OPTS="--link $PREFIX-discovery:discovery" fi ID=$(docker run \ -ti \ -d \ --restart=always \ --name $PREFIX-swarm-manager \ --volumes-from=$PREFIX-certs $EXTRA_RUN_OPTS \ swarm:latest \ m --replication --addr $SHIPYARD_IP:$SWARM_PORT --host tcp://0.0.0.0:$SWARM_PORT $TLS_OPTS $DISCOVERY) } remove_swarm_manager() { docker rm -fv $PREFIX-swarm-manager > /dev/null 2>&1 } start_swarm_agent() { get_ip if [ -z "$DISCOVERY" ]; then DISCOVERY="$DISCOVERY_BACKEND://discovery:$DISCOVERY_PORT" EXTRA_RUN_OPTS="--link $PREFIX-discovery:discovery" fi ID=$(docker run \ -ti \ -d \ --restart=always \ --name $PREFIX-swarm-agent $EXTRA_RUN_OPTS \ swarm:latest \ j --addr $SHIPYARD_IP:$PROXY_PORT $DISCOVERY) } remove_swarm_agent() { docker rm -fv $PREFIX-swarm-agent > /dev/null 2>&1 } start_controller() { #-v $CERT_PATH:/etc/docker:ro \ TLS_OPTS="" if [ $ENABLE_TLS = 1 ]; then TLS_OPTS="--tls-ca-cert $SSL_CA_CERT --tls-cert=$SSL_CERT --tls-key=$SSL_KEY --shipyard-tls-ca-cert=$SSL_CA_CERT --shipyard-tls-cert=$SSL_CERT --shipyard-tls-key=$SSL_KEY" fi ID=$(docker run \ -ti \ -d \ --restart=always \ --name $PREFIX-controller \ --link $PREFIX-rethinkdb:rethinkdb \ --link $PREFIX-swarm-manager:swarm \ -p $SHIPYARD_PORT:$SHIPYARD_PORT \ --volumes-from=$PREFIX-certs \ $IMAGE \ --debug \ server \ --listen :$SHIPYARD_PORT \ -d tcp://swarm:$SWARM_PORT $TLS_OPTS $SHIPYARD_ARGS) } wait_for_available() { set +e IP=$1 PORT=$2 echo Waiting for Shipyard on $IP:$PORT docker pull ehazlett/curl > /dev/null 2>&1 TLS_OPTS="" if [ $ENABLE_TLS = 1 ]; then TLS_OPTS="-k" fi until $(docker run --rm ehazlett/curl --output /dev/null --connect-timeout 1 --silent --head --fail $TLS_OPTS $SHIPYARD_PROTOCOL://$IP:$PORT/ > /dev/null 2>&1); do printf '.' sleep 1 done printf '\n' } remove_controller() { docker rm -fv $PREFIX-controller > /dev/null 2>&1 } if [ "$ACTION" = "deploy" ]; then set -e check_certs get_ip echo "Deploying Shipyard" echo " -> Starting Database" start_rethinkdb echo " -> Starting Discovery" start_discovery echo " -> Starting Cert Volume" start_certs echo " -> Starting Proxy" start_proxy echo " -> Starting Swarm Manager" start_swarm_manager echo " -> Starting Swarm Agent" start_swarm_agent echo " -> Starting Controller" start_controller wait_for_available $SHIPYARD_IP $SHIPYARD_PORT echo "Shipyard available at $SHIPYARD_PROTOCOL://$SHIPYARD_IP:$SHIPYARD_PORT" if [ $ENABLE_TLS = 1 ] && [ ! -z "$CERT_FINGERPRINT" ]; then echo "SSL SHA-256 Fingerprint: $CERT_FINGERPRINT" fi echo "Username: admin Password: shipyard" elif [ "$ACTION" = "node" ]; then set -e if [ -z "$DISCOVERY" ]; then echo "You must set the DISCOVERY environment variable" echo "with the discovery system used with Swarm" exit 1 fi check_certs echo "Adding Node" echo " -> Starting Cert Volume" start_certs echo " -> Starting Proxy" start_proxy echo " -> Starting Swarm Manager" start_swarm_manager $DISCOVERY echo " -> Starting Swarm Agent" start_swarm_agent echo "Node added to Swarm: $SHIPYARD_IP" elif [ "$ACTION" = "upgrade" ]; then set -e check_certs get_ip echo "Upgrading Shipyard" echo " -> Pulling $IMAGE" docker pull $IMAGE echo " -> Upgrading Controller" remove_controller start_controller wait_for_available $SHIPYARD_IP $SHIPYARD_PORT echo "Shipyard controller updated" elif [ "$ACTION" = "remove" ]; then # ignore errors set +e echo "Removing Shipyard" echo " -> Removing Database" remove_rethinkdb echo " -> Removing Discovery" remove_discovery echo " -> Removing Cert Volume" remove_certs echo " -> Removing Proxy" remove_proxy echo " -> Removing Swarm Agent" remove_swarm_agent echo " -> Removing Swarm Manager" remove_swarm_manager echo " -> Removing Controller" remove_controller echo "Done" else echo "Unknown action $ACTION" exit 1 fi [root@warship ~]# [root@warship ~]# sed -i 's/shipyard\/shipyard:latest/dockerclub\/shipyard:latest/g' shipyard-deploy [root@warship ~]# [root@warship ~]# sh shipyard-deploy Unable to find image 'alpine:latest' locally latest: Pulling from library/alpine 9d48c3bd43c5: Pulling fs layer 9d48c3bd43c5: Verifying Checksum 9d48c3bd43c5: Download complete 9d48c3bd43c5: Pull complete Digest: sha256:72c42ed48c3a2db31b7dafe17d275ba708d901ec9fd57bf01fb Status: Downloaded newer image for alpine:latest Deploying Shipyard -> Starting Database Unable to find image 'rethinkdb:latest' locally latest: Pulling from library/rethinkdb e7a7e: Pulling fs layer 0ca7c739ad6e: Pulling fs layer cdc54: Pulling fs layer 5d6127e7f6f6: Pulling fs layer 68af5fd8cef9: Pulling fs layer 5d6127e7f6f6: Waiting 68af5fd8cef9: Waiting 0ca7c739ad6e: Verifying Checksum 0ca7c739ad6e: Download complete cdc54: Verifying Checksum cdc54: Download complete 68af5fd8cef9: Verifying Checksum 68af5fd8cef9: Download complete 5d6127e7f6f6: Verifying Checksum 5d6127e7f6f6: Download complete e7a7e: Verifying Checksum e7a7e: Download complete e7a7e: Pull complete 0ca7c739ad6e: Pull complete cdc54: Pull complete 5d6127e7f6f6: Pull complete 68af5fd8cef9: Pull complete Digest: sha256:7af2b5ae9a83c6aae97f5c6e3437cef0d359e62693edda1cff5d364af4 Status: Downloaded newer image for rethinkdb:latest -> Starting Discovery Unable to find image 'microbox/etcd:latest' locally latest: Pulling from microbox/etcd 8ded6e8ab3fd: Pulling fs layer bf8f85223d7a: Pulling fs layer a3ed95caeb02: Pulling fs layer a3ed95caeb02: Verifying Checksum a3ed95caeb02: Download complete bf8f85223d7a: Verifying Checksum bf8f85223d7a: Download complete 8ded6e8ab3fd: Verifying Checksum 8ded6e8ab3fd: Download complete 8ded6e8ab3fd: Pull complete bf8f85223d7a: Pull complete a3ed95caeb02: Pull complete Digest: sha256:941fd46b4eab265c65da9bfbf33397b853a7cef6c16df93a1e3fea7b4e47fc90 Status: Downloaded newer image for microbox/etcd:latest -> Starting Cert Volume -> Starting Proxy Unable to find image 'shipyard/docker-proxy:latest' locally latest: Pulling from shipyard/docker-proxy 8f4ec95ceaee: Pulling fs layer ac77a345f217: Pulling fs layer 43039e3ef672: Pulling fs layer a3ed95caeb02: Pulling fs layer a3ed95caeb02: Waiting 43039e3ef672: Verifying Checksum 43039e3ef672: Download complete ac77a345f217: Verifying Checksum ac77a345f217: Download complete 8f4ec95ceaee: Verifying Checksum 8f4ec95ceaee: Download complete 8f4ec95ceaee: Pull complete a3ed95caeb02: Verifying Checksum a3ed95caeb02: Download complete ac77a345f217: Pull complete 43039e3ef672: Pull complete a3ed95caeb02: Pull complete Digest: sha256:da6bbd1aa940d44940cce0f43705d7f8ec552a4e97e77104ec1b6dc3d1 Status: Downloaded newer image for shipyard/docker-proxy:latest -> Starting Swarm Manager Unable to find image 'swarm:latest' locally latest: Pulling from library/swarm d85c18077b82: Pulling fs layer 1e6bb16f8cb1: Pulling fs layer 85bac13497d7: Pulling fs layer 85bac13497d7: Verifying Checksum 85bac13497d7: Download complete 1e6bb16f8cb1: Verifying Checksum 1e6bb16f8cb1: Download complete d85c18077b82: Verifying Checksum d85c18077b82: Download complete d85c18077b82: Pull complete 1e6bb16f8cb1: Pull complete 85bac13497d7: Pull complete Digest: sha256:ba3b8791bcd705b7bc0fd94c66b695a1a2dbaeb5f59ed29940e5015dc8 Status: Downloaded newer image for swarm:latest -> Starting Swarm Agent -> Starting Controller Unable to find image 'dockerclub/shipyard:latest' locally latest: Pulling from dockerclub/shipyard 4d06f2521e4f: Pulling fs layer a: Pulling fs layer 36ad6d: Pulling fs layer a823ae228c2d: Pulling fs layer a3ed95caeb02: Pulling fs layer a823ae228c2d: Waiting a3ed95caeb02: Waiting 4d06f2521e4f: Verifying Checksum 4d06f2521e4f: Download complete 4d06f2521e4f: Pull complete 36ad6d: Verifying Checksum 36ad6d: Download complete a: Verifying Checksum a: Download complete a: Pull complete 36ad6d: Pull complete a3ed95caeb02: Verifying Checksum a3ed95caeb02: Download complete a823ae228c2d: Verifying Checksum a823ae228c2d: Download complete a823ae228c2d: Pull complete a3ed95caeb02: Pull complete Digest: sha256:bd5ac58cf7788db18fc6fed3bcefb294e469babbeb87ad7ef15e219 Status: Downloaded newer image for dockerclub/shipyard:latest Waiting for Shipyard on 192.168.18.128:8080 Shipyard available at http://192.168.18.128:8080 Username: admin Password: shipyard
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/204913.html原文链接:https://javaforall.net
