可以参考官网文档

  1. 创建文件夹;

    mkdir -p /opt/shipyard
    cd /opt/shipyard
    
  2. 创建脚本;

    vim start.sh
    
  3. 编辑脚本内容;

    #!/bin/bash
    
    docker pull rethinkdb microbox/etcd shipyard/docker-proxy:latest swarm:latest shipyard/shipyard
    
    docker rm -f shipyard-controller shipyard-swarm-agent shipyard-swarm-manager shipyard-proxy shipyard-discovery shipyard-rethinkdb
    
    docker run \
        -d \
        --restart=always \
        --name shipyard-rethinkdb \
        rethinkdb
    
    docker run \
        -d \
        -p 4001:4001 \
        -p 7001:7001 \
        --restart=always \
        --name shipyard-discovery \
        microbox/etcd -name discovery
    
    docker run \
        -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
    
    docker run \
        -d \
        --restart=always \
        --name shipyard-swarm-manager \
        swarm:latest \
        manage --host tcp://0.0.0.0:3375 etcd://120.27.144.238:4001
    
    docker run \
        -d \
        --restart=always \
        --name shipyard-swarm-agent \
        swarm:latest \
        join --addr 120.27.144.238:2375 etcd://120.27.144.238:4001
    
    docker run \
        -d \
        --restart=always \
        --name shipyard-controller \
        --link shipyard-rethinkdb:rethinkdb \
        --link shipyard-swarm-manager:swarm \
        -p 9999:8080 \
        shipyard/shipyard:latest \
        server \
        -d tcp://swarm:3375
    
  4. 赋予脚本可执行权限;

    chmod +x ./start.sh
    
  5. 执行脚本;

    /opt/shipyard/start.sh
    # 或在/opt/shipyard下执行
    ./start.sh
    

Ably
603 声望44 粉丝

Let everything around us become better


引用和评论

0 条评论