curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
sudo service docker start
注意:官方软件源默认启用了最新的软件,您可以通过编辑软件源的方式获取各个版本的软件包。例如官方并没有将测试版本的软件源置为可用,你可以通过以下方式开启。同理可以开启各种测试版本等。
vim /etc/yum.repos.d/docker-ce.repo将 [docker-ce-test] 下方的 enabled=0 修改为 enabled=1
yum list docker-ce.x86_64 --showduplicates | sort -r
Loading mirror speeds from cached hostfile
Loaded plugins: branch, fastestmirror, langpacks
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos @docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
Available Packages
yum -y install docker-ce-[VERSION]
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
docker-compose version 1.22.0, build 1719ceb
以上方式不行,可以切换下一种方式:
yum -y install epel-release
yum -y install python-pip
:- step3:安装完之后别忘了清除一下cache
yum clean all
pip install -U docker-compose
wget https://storage.googleapis.com/harbor-releases/release-1.6.0/harbor-offline-installer-v1.6.0.tgz
wget https://storage.googleapis.com/harbor-releases/release-1.6.0/harbor-online-installer-v1.6.0.tgz
tar xvf harbor-online-installer-<version>.tgz //在线版
tar xvf harbor-offline-installer-<version>.tgz //离线版
vim harbor.cfg
./install.sh
安装完成后,登录配置文件中设置的IP地址,默认管理员账户密码为admin/Harbor12345
vi /etc/sysconfig/docker
INSECURE_REGISTRY='--insecure-registry 192.168.10.10:5000 --insecure-registry 192.168.10.10'
//重启系统服务
systemctl daemon-reload
systemctl restart docker.service
docker-compose stop
Stopping nginx ... done
Stopping harbor-jobservice ... done
Stopping harbor-core ... done
Stopping harbor-db ... done
Stopping registry ... done
Stopping harbor-log ... done
docker-compose down -v //先停止已经运行的harbor
vim harbor.cfg //修改配置文件
prepare //执行prepa脚本使配置生效
docker-compose up -d //重新启动Harbor
$ rm -r /data/database
$ rm -r /data/registry
vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry 192.168.1.113\ //增加--insecure-registry 192.168.1.113\
systemctl daemon-reload
systemctl restart docker
创建/etc/docker/daemon.json文件,在文件中指定仓库地址
# cat > /etc/docker/daemon.json << EOF
{ "insecure-registries":["rgs.unixfbi.com"] }
EOF
# systemctl restart docker
登录Harbor
docker login 192.168.1.113
//输入账号
//输入密码