docker环境搭建

  1. 安装RedHat7

  2. 配置代理

    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
  3. 使用阿里源需要把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快速替换。保存退出。

  4. yum makecache更新源信息。

  5. 安装相关依赖

    yum install -y yum-utils device-mapper-persistent-data lvm2 
  6. 安装docker安装包。

    yum install -y docker
  7. 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"
  8. 重启docker

    systemctl daemon-reload
    systemctl restart docker
  9. 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

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值