目录

Docker

1 Overview

2 Docker Install

2.1 Mac Install docker

brew cask install docker

2.2 docker auths

cat ~/.docker/config.json
{
  "auths" : {
    "xxxx.com" : {
      "auth" : "xxxx"
    }
  },
  "stackOrchestrator" : "swarm"
}

3 rancher

3.1 install

1. MAC OS 先安装一个rangeros,需要先安装个虚拟机,复制到浏览器中下载
https://www.virtualbox.org/wiki/Downloads
version: 6.1.2

2. 安装docker-machine
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
  curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
  chmod +x /usr/local/bin/docker-machine

3. 创建ranger os
 docker-machine create -d virtualbox \
--virtualbox-boot2docker-url https://releases.rancher.com/os/latest/rancheros.iso \
--virtualbox-memory 3072 \
rancher-machine

➜  Downloads docker-machine ls
NAME              ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
rancher-machine   -        virtualbox   Running   tcp://192.168.99.100:2376           v19.03.5

-w1078

-w720

#查看虚拟机IP
➜  Downloads docker-machine ip rancher-machine
192.168.99.100
#进入虚拟机
➜  Downloads docker-machine ssh rancher-machine
[docker@rancher-machine ~]$ docker -v
Docker version 19.03.5, build 633a0ea838

4. 启动rancher image
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

-w1128

https://192.168.99.100
#首次登陆需要设置admin 密码

-w760

-w437

-w437

-w1353

3.2 使用

集群->添加集群->自定义 from RKE

集群名称:test
描述:测试
...
根据实际情况选择
下一步
添加主机
复制此命令到agent机器上

-w1349

-w1352

4 Harbor

4.1 Harbor single install

https://github.com/goharbor/harbor

#docker 17.06.0-ce+ and docker-compose 1.18.0+ 

cd /usr/src/
#下载安装包
wget https://github.com/goharbor/harbor/releases/download/v1.10.1/harbor-offline-installer-v1.10.1.tgz
#解压
tar xvf harbor-offline-installer-v1.10.1.tgz

10 Docker public images

10.1 Mysql

docker pull mysql:5.6
docker images |grep mysql
mkdir -p ~/mysql/data ~/mysql/logs ~/mysql/conf
#run mysql
docker run -p 3306:3306 --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6

#cli login
mysql -h `hostname` -P 3306 -u root -p123456