在linux中docker的安装以及出现的问题

1.安装docker必须要连网,先检查是否已连接网络

可参考官网进行安装
官网网址:官网参考手册

2.查看本机是否安装有CentOS

cat /etc/redhat-release    #如果不是CentOS 7有一些命令是不一样的

3.安装环境

yum -y install gcc gcc-c++

4.卸载历史版本

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

5.安装所需要的软件包

 yum install -y yum-utils

5.1但是我这一步便出现了问题,问题如下

failure: repodata/repomd.xml from mirrors: [Errno 256] No more mirrors to try.
http://mirrors/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors; Unknown error"

最终参考了博客,得以解决:
https://blog.csdn.net/weixin_42728126/article/details/114378035

6配置stable镜像仓库

#官网上的是国外的,这里使用国内的阿里云比较快
yum-config-manager --add-repo http://mirrors aliyun.com/docker-ce/linux/centos/docker-ce.repo

7.更新yum软件包索引

yum makecache fast

8.安装Docker CE

yum -y install docker-ce docker-ce-cli containerd.io

8.1.出现新的问题,如下

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
No package docker-ce available.
No package docker-ce-cli available.
No package containerd.io available.
Error: Nothing to do

最终参考了博客,得以解决:
https://blog.csdn.net/qq_25760623/article/details/88657491

9.一些其他命令

#测试
docker version
docker run hello-world
docker images

#关闭docker
systemctl stop docker

#查看docker状态
systemctl status docker

#查看当前docker的进程
ps -ef|grep docker
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值