centos8安装docker
不得不说国内的墙真是太厉害了,好的不好的都给你屏蔽了,这难道不是另外一种形式的闭关锁国?
无形中增加技术人员的难度,这不是为难我胖虎么?
配置国内dnf
1、dnf清除配置
dnf clean all
2、备份原dnf配置
mv /etc/yum.repos.d /etc/yum.repos.d.bak
3、创建新的dnf配置
mkdir /etc/yum.repos.d cd /etc/yum.repos.d vim CentOS-Base.repo
输入如下内容并保存
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - mirrors.aliyun.com #failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/ http://mirrors.aliyuncs.com/centos/$releasever/BaseOS/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com #failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/os/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com #failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/os/ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official [PowerTools] name=CentOS-$releasever - PowerTools - mirrors.aliyun.com #failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/PowerTools/$basearch/os/ http://mirrors.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official [AppStream] name=CentOS-$releasever - AppStream - mirrors.aliyun.com #failovermethod=priority
4、重新生成dnf缓存
dnf makecache
至此dnf配置已经完成
安装yum工具配置国内镜像仓库
1、安转yum工具
yum install -y yum-utils
2、配置国内镜像仓库
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装docker
1、安装docker
docker-ce --nobest
2、配置docker国内国内镜像仓库地址
2.1、进入docker配置文件目录,没有则创建。
cd /etc/docker
2.2、编辑配置文件,没有则创建
vim daemon.json
输入如下内容并保存,其中指定了国内镜像加速地址和容器存放数据目录,这里建议修改成数据盘挂载目录。
{ "registry-mirrors": ["https://nsybtd8u.mirror.aliyuncs.com"], "insecure-registries": ["192.168.1.54:8000"], "data-root":"/home/docker" }
启动docker
systemctl enable docker systemctl start docker
安装docker-compose
1、下载
sudo curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2、授权
sudo chmod +x /usr/local/bin/docker-compose
3、验证
docker-compose --version
发表回复
要发表评论,您必须先登录。