统信操作系统安装Docker

1操作系统信息

在这里插入图片描述

2 当前系统预装了Docker相关文件,因此以下两个步骤无需操作,yum search docker(检查系统是否可以安装Docker):

1.安装环境
yum install -y yum-utils
2.设置镜像仓库
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
仓库地址默认是国外的,百度搜索docker阿里云镜像地址,并设置
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3 使用yum命令时,提示有2个问题

模块依赖问题:

 问题 1: module docker:uelc20:2020230105014926:bd07c72b-0.x86_64 requires module(container-tools:uelc20), but none of the providers can be installed
  - module container-tools:uelc20:2020220902112528:b5192a5c-0.x86_64 conflicts with module(container-tools:an8) provided by container-tools:an8:2020220106133314:b4ae771c-0.x86_64
  - module container-tools:an8:2020220106133314:b4ae771c-0.x86_64 conflicts with module(container-tools:uelc20) provided by container-tools:uelc20:2020220902112528:b5192a5c-0.x86_64
  - module container-tools:uelc20:2020221229072209:b5192a5c-0.x86_64 conflicts with module(container-tools:an8) provided by container-tools:an8:2020220106133314:b4ae771c-0.x86_64
  - module container-tools:an8:2020220106133314:b4ae771c-0.x86_64 conflicts with module(container-tools:uelc20) provided by container-tools:uelc20:2020221229072209:b5192a5c-0.x86_64
  - module container-tools:uelc20:2020230130082020:b5192a5c-0.x86_64 conflicts with module(container-tools:an8) provided by container-tools:an8:2020220106133314:b4ae771c-0.x86_64
  - module container-tools:an8:2020220106133314:b4ae771c-0.x86_64 conflicts with module(container-tools:uelc20) provided by container-tools:uelc20:2020230130082020:b5192a5c-0.x86_64
  - conflicting requests
 问题 2: module rust-toolset:uelc20:2020221215055743:301fb081-0.x86_64 requires module(llvm-toolset:uelc20), but none of the providers can be installed
  - module llvm-toolset:uelc20:2020220702202350:37d8506f-0.x86_64 conflicts with module(llvm-toolset:an8) provided by llvm-toolset:an8:2020211222153255:37d8506f-0.x86_64
  - module llvm-toolset:an8:2020211222153255:37d8506f-0.x86_64 conflicts with module(llvm-toolset:uelc20) provided by llvm-toolset:uelc20:2020220702202350:37d8506f-0.x86_64
  - module llvm-toolset:uelc20:2020221115064120:37d8506f-0.x86_64 conflicts with module(llvm-toolset:an8) provided by llvm-toolset:an8:2020211222153255:37d8506f-0.x86_64
  - module llvm-toolset:an8:2020211222153255:37d8506f-0.x86_64 conflicts with module(llvm-toolset:uelc20) provided by llvm-toolset:uelc20:2020221115064120:37d8506f-0.x86_64
  - conflicting requests

问题原因是某些模块被禁用导致的,需要对模块进行重置:

//模块状态查询命令
dnf module info container-tools
//模块重置命令
dnf module reset container-tools
dnf module reset llvm-toolset

4 安装Docker

注意:系统中预装了类似于docker的软件podman,最好将其卸载
     安装Docker时,命令一定不能使用:yum -y install docker,会让系统以为我们想装的是podman—docker,导致之后的docker启动命令提示:Failed to start docker.service: Unit docker.service not found.
//查看是否安装podman
rpm -q podman
//podman卸载
dnf remove podman
//docker安装
yum install docker-ce

5 启动Docker

//启动
 systemctl start docker
//加入自启
 systemctl enable  docker
//docker版本
 docker version

6 Docker测试

//以hello-world镜像为模板生成一个hello-world的容器实例并运行
docker run hello-world
//查看下载的 hello-world 镜像
docker images

7 卸载Docker

//删除安装包
yum remove docker-ce
//删除镜像、容器、配置文件等内容
rm -rf /var/lib/docker

8 很多情况下,不使用root账户进行操作,通常新建一个账户,使用管理员权限进行相关操作

//创建用户UserTest
//sudo 普通用户使用管理员权限
//-m:自动建立用户的登入目录
sudo useradd -m UserTest
//设置UserTest密码
passwd UserTest
//修改文件,给账户设置权限
//最好使用root账户进行设置
su - root  //切换账户
//若不设置,使用sudo时,会提示:用户 不在 sudoers 文件中。此事将被报告
//给root账户添加修改权限
chmod 640 /etc/sudoers
//进入文件修改,添加内容如下图
vim /etc/sudoers
//添加完成后,点击“Ecs”退出,输入:wq保存并退出
//查看是否修改成功
cat /etc/sudoers
//撤销root对该文件的修改权限
chmod 440 /etc/sudoers

在这里插入图片描述
如此,UserTest账户便可以使用管理员权限进行操作了

deluser UserTest
//连同主目录一同删除
deluser --remove-home UserTest
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FlYFlOWERANDLEAF

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值