天天看点

docker-compose方式搭建harbor私人镜像仓库

一、安装docker

注意事项:
1.替换国内的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo &> /dev/null
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo &> /dev/null
yum clean all
yum makecache
2.服务器时区和时间保持国内
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3.selinux和firewalld关闭
systemctl stop firewalld
4.内核版本3.10以上
5.ipv4转发
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
安装
(1)安装依赖包
     yum install -y yum-utils device-mapper-persistent-data lvm2 
(2)添加docker软件包源
     yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
(3)安装docker CE
     yum install docker-ce-18.06.3.ce -y  //这个版本最香
(4)启动
     systemctl start docker
	 systemctl enable docker
(5)配置docker镜像加速器
     	 在/etc/docker/daemon.json 中加入:
cat >>/etc/docker/daemon.json<< EOF
{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
EOF
           

二、按装docker-compose

注意需要下载docker-compose-Linux-x86_64 /可以到阿里源或其他网站上找

wget http://192.168.210.5/docker-compose-Linux-x86_64
cp docker-compose-Linux-x86_64 /usr/bin/docker-compose-Linux-x86_64
chmod a+x /usr/bin/docker-compose				
           

3.下载安装harbor

wget http://192.168.210.5/package/harbor-offline-installer-v1.5.1.tgz
tar xf harbor-offline-installer-v1.5.1.tgz
cd harbor/
修改里面的hostname为自己的id和登录密码
vim harbor.cfg
hostname = 192.168.204.252
harbor_admin_password = 123456
安装		  
./install.sh
访问192.168.204.252