标签:ali hostname harbor ffline releases ror server ctrl host
更改主机名,关闭防火墙和selinux
hostnamectl set-hostname 7niu
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config
yum install -y yum-utils device-mapper-persistent-data lvm2
添加Docker软件包源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
如连接失败可以手动上传文件docker-ce.repo 到目录/etc/yum.repos.d
阿里云源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新yum包索引
yum makecache fast
列出所有 yum repolist
清除缓存 yum clean all
安装Docker CE
查看源中的所含docker版本
yum list docker-ce --showduplicates | sort -r
yum install docker-ce docker-ce-cli containerd.io
启动
systemctl start docker
#设置开机启动
systemctl enable docker
查看版本
docker version
卸载
yum remove docker-ce
rm -rf /var/lib/docker
#sudo curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
#sudo chmod +x /usr/local/bin/docker-compose
#[root@ctrl cert]# docker-compose version
docker-compose version 1.26.0, build d4451659
docker-py version: 4.2.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
创建证书目录,并赋予权限
mkdir -p /data/cert && chmod -R 777 /data/cert && cd /data/cert
生成私钥,需要设置密码
openssl genrsa -des3 -out harbor.key 2048
生成CA证书,需要输入密码
openssl req -sha512 -new -subj "/C=CN/ST=JS/L=WX/O=zwx/OU=jhmy/CN=hub.jhmy.com" -key harbor.key -out harbor.csr
备份证书
cp harbor.key harbor.key.org
退掉私钥密码,以便docker访问(也可以参考官方进行双向认证)
openssl rsa -in harbor.key.org -out harbor.key
使用证书进行签名
openssl x509 -req -days 365 -in harbor.csr -signkey harbor.key -out harbor.crt
编辑harbor.yaml ,修改hostname,port 和证书路径以及 登录密码
[root@ctrl harbor]# cat harbor.yml |grep -v ^$ | grep -v ^#
hostname: ctrl.emay.cn
http:
port: 8090
https:
port: 443
certificate: /data/cert/harbor.crt
private_key: /data/cert/harbor.key
harbor_admin_password: HaHaB1gdate
执行安装操作
[root@ctrl harbor]# ./prepare
[root@ctrl harbor]# ./install.sh
配置镜像仓库地址(推荐配置域名)
vim /etc/docker/daemon.json
{
"insecure-registries": ["serverip"]
}
下载测试镜像
docker pull hello-world
给镜像重新打标签
docker tag hello-world serverip/hello-world:latest
登录进行上传
docker login serverip
docker push serverip/hello-world:latest
标签:ali hostname harbor ffline releases ror server ctrl host
原文地址:https://www.cnblogs.com/ainimore/p/13156170.html