-
安装RedHat7
-
配置代理
vim /etc/profile
加入
export http_proxy=<代理ip地址>:<端口号> epxort https_proxy=<代理ip地址>:<端口号> export no_proxy=localhost,127.0.0.1,192.168.170.137
使代理起效
source profile
-
使用阿里源需要把Centos-7.repo文件中的$releasever全部替换为7,因为阿里云没有redhat的源。
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo cd /etc/yum.repos.d/ ls vim CentOS-Base.repo
在vim中执行:%s/$releasever/7/g快速替换。保存退出。
-
yum makecache更新源信息。
-
安装相关依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
-
安装docker安装包。
yum install -y docker
-
docker代理配置
mkdir /etc/systemd/system/docker.service.d vim /etc/systemd/system/docker.service.d/http-proxy.conf
[Service] Environment="HTTP_PROXY=http://<代理ip地址>:<端口号>/" Environment="HTTPS_PROXY=http://<代理ip地址>:<端口号>/" Environment="NO_PROXY=localhost,127.0.0.1,192.168.170.137"
-
重启docker
systemctl daemon-reload systemctl restart docker
-
docker启动失败。
vi /etc/sysconfig/docker OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
docker私有仓库搭建
配置docker镜像源
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
配置阿里的epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
安装Python-pip
yum install python-pip -y
升级Python-ppip
pip install --upgrade pip
安装docker-compose
pip install docker-compose
查看docker-compose版本
# docker-compose -v docker-compose version 1.24.0, build 0aa5906
安装harbor -下载harbor离线安装包。
https://github.com/goharbor/harbor/releases
解压
# tar -zxvf harbor-offline-installer-v1.7.5.tgz # cd harbor
vim harbor.cfg
hostname = 192.168.170.137:80
启动harbor
./prepare ./install.sh
服务器搭建成功。
docker客户端环境配置
客户端只需要安装docker就行。
# vim /etc/docker/daemon.json { "insecure-registries":["192.168.170.137:80"] }
# vim /etc/profile export no_proxy=192.168.170.137
harbor服务启动
# docker-compse down # docker-compose up -d