8.6 Docker企业版本地安装之UCP

初始化虚拟机

Vagrantfile内容如下

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version ">= 1.6.0"
boxes = [
    {
        :name => "docker-ee-manager",
        :eth1 => "192.168.205.13",
        :mem => "5120",
        :cpu => "1"
    },
    {
        :name => "docker-ee-work",
        :eth1 => "192.168.205.14",
        :mem => "3072",
        :cpu => "1"
    }
]

Vagrant.configure(2) do |config|
  config.vm.box = "centos/7"
  boxes.each do |opts|
    config.vm.define opts[:name] do |config|
      config.vm.hostname = opts[:name]
      config.vm.provider "virtualbox" do |v|
        v.customize ["modifyvm", :id, "--memory", opts[:mem]]
        v.customize ["modifyvm", :id, "--cpus", opts[:cpu]]
      end
      config.vm.network :private_network, ip: opts[:eth1]
    end
  end
  config.vm.synced_folder ".", "/vagrant", :disabled => true
  config.vm.provision "shell", privileged: true, path: "./setup.sh"
end

setup.sh

#!/usr/bin/env bash
#/bin/sh
# install some tools
sudo yum install -y git vim gcc glibc-static telnet bridge-utils
# start docker service
sudo groupadd docker
sudo usermod -aG docker vagrant

安装docker-ee

安装指南  https://docs.docker.com/insta...

访问 https://store.docker.com/search?offering=enterprise&type=edition 后,选择centos版,然后申请试用,即可拿到DOCKERURL地址

在docker-ee-manager和docker-ee-work上执行如下命令

export DOCKERURL="[https://storebits.docker.com/ee/centos/sub-3cdef8e1-28a5-45b6-a95c-c9c4c5d0810c](https://storebits.docker.com/ee/centos/sub-3cdef8e1-28a5-45b6-a95c-c9c4c5d0810c)"
sudo -E sh -c 'echo "$DOCKERURL/centos" > /etc/yum/vars/dockerurl'
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo -E yum-config-manager --add-repo "$DOCKERURL/centos/docker-ee.repo"
sudo yum -y install docker-ee
sudo systemctl start docker

查看版本

[vagrant@docker-ee-manager ~]$ docker version
Client: Docker Enterprise Edition (EE) 2.0
 Version: 17.06.2-ee-14
 API version: 1.30
 Go version: go1.8.7
 Git commit: 6345dd7
 Built: Thu Jun 21 18:13:03 2018
 OS/Arch: linux/amd64
Server: Docker Enterprise Edition (EE) 2.0
 Engine:
  Version: 17.06.2-ee-14
  API version: 1.30 (minimum version 1.12)
  Go version: go1.8.7
  Git commit: 6345dd7
  Built: Thu Jun 21 18:14:24 2018
  OS/Arch: linux/amd64
  Experimental: false

安装UCP

Docker Universal Control Plane

# 安装过程中会要求设置UCP的账号与密码
# 由于当前的vagrant虚机ip为192.168.205.13,ucp的--pod-cidr默认是192.168.0.0/16,这会导致网络冲突
# 因此需要特别指定--pod-cidr 192.168.0.0/24选项
[vagrant@docker-ee-manager ~]$ docker container run --rm -it --name ucp -v /var/run/docker.sock:/var/run/docker.sock docker/ucp:3.0.2 install --host-address 192.168.205.13 --interactive --pod-cidr 192.168.0.0/24

然后通过访问如下url就可以进入到登陆界面了

# 证书会不受信任,选择仍然访问即可
https://192.168.205.13/

登录成功之后,如果提示Your system is unlicensed,则点击Upload License,上传申请试用获得的License即可。

重置UCP管理员密码

docker exec -it ucp-auth-api enzi "$(docker inspect --format '{{ index .Args 0 }}' ucp-auth-api)" passwd -i

添加Worker Node

[vagrant@docker-ee-work ~]$ docker swarm join --token SWMTKN-1-48hxmlsky9gpomdrrs8v6cpyhjc6f3vya9xs143mz24jgoemx6-0oqcwi8hhv8gdxk03ejd19v61 192.168.205.13:2377
This node joined a swarm as a worker.

你可能感兴趣的:(docker)