Windows玩转Kubernetes系列2-Centos安装Docker
接上一章,Windows玩转Kubernetes系列1-VirtualBox安装Centos,我们开始学习如何在Centos中安装Docker
准备
关闭防火墙
防火墙一定要提前关闭,否则在后续安装K8S集群的时候,会有一些问题,执行下面语句:
systemctl stop firewalld & systemctl disable firewalld
关闭Swap
vi /etc/fstab
注掉swap
关闭SeLinux
setenforce 0
配置yum源
cd /etc/yum.repos.d ls mkdir backup mv Cen* backup/
下载centos基础yum源配置
curl -o CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
下载docker的yum源配置
curl -o docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
配置kubernetes的yum源
vi /etc/yum.repos.d/kubernetes.repo
复制以下内容,并保存
[kubernetes] name=Kubernetes baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=0 repo_gpgcheck=0 gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
刷新yum源缓存
yum clean all yum makecache yum repolist
安装Docker
直接安装最新版
yum install -y docker-ce
如果比较慢,用以下的阿里云yum源
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo sudo yum makecache fast sudo yum -y install docker-ce
如果指定docker版本,可搜索docker-ce可用镜像
yum list docker-ce --showduplicates | sort -r
列出所有版本,再执行
yum install -y docker-ce-版本号
查看Docker是否安装成功
docker -v
启动Docker服务并激活开机启动
systemctl start docker & systemctl enable docker
运行一条命令验证一下
docker run hello-world
此时如果报错:
Error response from daemon: Get https://registry-1.docker.io/v2/
vi /etc/docker/daemon.json
复制以下内容:
{ "registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com","https://pee6w651.mirror.aliyuncs.com"] } ~
重启Docker,解决
systemctl daemon-reload systemctl restart docker
相关推荐
锋锋 2020-10-26
liusaisoso 2020-08-19
limx 2020-08-19
知行合一止于至善 2020-08-19
xingyuzhe 2020-09-21
JustHaveTry 2020-09-11
朱培知浅ZLH 2020-11-16
cdbdqn00 2020-11-12
达观数据 2020-11-11
JustinChia 2020-11-11
远远的山 2020-11-09
jingtao 2020-11-08
大叔比较胖 2020-10-30
gracecxj 2020-10-30
onepiecedn 2020-10-29
kunyus 2020-10-28
JustHaveTry 2020-10-27
hubanbei00的家园 2020-10-25
谢恩铭 2020-10-23