当前位置: 首页 > news >正文

yum安装Docker(CentOS7.9)

目录

          一、安装环境

编写yum源(根据系统版本)

二、安装docker-ce

默认安装docker-ce是最新版本

ps:安装不成功则需要安装container-selinux,下载网络yum源,再安装docker-ce即可

#查看dcoker-ce所产生的文件路径

三、启动docker

四、配置镜像加速器

第一种:docker cn 加速

第二种:中国科技大学

其他:阿里云,DaoCloud需要申请账号获得个人链接。

#运行一个比较简单的容器


学习docker需要学习到docker镜像、docker容器、docker仓库。

docker安装官方文档:Install Docker Engine on CentOS

一、安装环境

编写yum源(根据系统版本)

[root@docker-learn yum.repos.d]# vim aliyun.repo
[base]
name=base
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/os/x86_64/
gpgcheck=0
​
[root@docker-learn yum.repos.d]# vim docker-ce.repo
[docker-ce]
name=docker
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7.9/x86_64/stable/
gpgcheck=0
#缓存
[root@docker-learn yum.repos.d]# yum makecache fast#查看有哪些缓存
[root@docker-learn yum.repos.d]# yum repolist清除缓存
[root@docker-learn yum.repos.d]# yum clearn all

二、安装docker-ce

默认安装docker-ce是最新版本

​[root@localhost ~]# yum -y install docker-ce 安装的是默认最新版本

ps:安装不成功则需要安装container-selinux,下载网络yum源,再安装docker-ce即可

[root@localhost yum.repos.d]# wget -0 /etc/yum.repos.d/Centos-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo#注:安装docker-ce需要container-selinux,以下仓库提供该包以及它的依赖包,如下是在官网[root@server ~]# vim /etc/yum.repos.d/centos-extras.repo
[root@server ~]# cat /etc/yum.repos.d/centos-extras.repo
[centos-extras]
name=centos
baseurl=http://mirror.centos.org/centos/7/extras/x86_64/
enabled=1
gpgcheck=0

接着再安装docker-ce

#查看dcoker-ce所产生的文件路径

[root@docker-learn yum.repos.d]# rpm -ql docker-ce
/etc/docker
/usr/bin/docker-init
/usr/bin/docker-proxy
/usr/bin/dockerd
/usr/lib/systemd/system/docker.service
/usr/lib/systemd/system/docker.socket

三、启动docker

[root@docker-learn yum.repos.d]# systemctl start docker

四、配置镜像加速器

如下主要是registry-mirrors有所改变

#查看Registry Mirrors

[root@docker-learn docker]# docker info

第一种:docker cn 加速

[root@docker-learn docker]# vim daemon.json
{
"registry-mirrors":["https://registry.docker-cn.com"]
}[root@docker-learn docker]# systemctl daemon-reload
[root@docker-learn docker]# systemctl restart docker

第二种:中国科技大学

[root@docker-learn docker]# vim daemon.json
{
"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}

#如果docker run报iptables disable的warning可进行开启

[root@docker-learn docker]# vim /etc/sysctl.conf
net.bridge.bridge-nf.call-iptables = 1
net.bridge.bridge-nf.call-ip6tables = 1
[root@docker-learn etc]# sysctl -p

其他:阿里云,DaoCloud需要申请账号获得个人链接。

#运行一个比较简单的容器

[root@docker-learn docker]# docker run hello-worldHello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)
3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/For more examples and ideas, visit:
https://docs.docker.com/get-started/

http://www.lryc.cn/news/36102.html

相关文章:

  • c++错误 free(): double free detected
  • 12升400V 升压DC-DC高压脱毛仪解决方案SC3671
  • h264格式分析
  • 【数据分析师求职面试指南】实战技能部分
  • 树与二叉树(二叉树的表示,性质,遍历,还原)
  • mysql 源码学习理解记录--lock_rec_move
  • markdown(.md)常用语法
  • 千言数据集赛题介绍
  • 信息技术最全总结(备考教资)
  • opencv识别车道线(霍夫线变换)
  • MySQL的同步数据Replication功能
  • 2023年全国最新高校辅导员精选真题及答案17
  • 中文代码92
  • Python SEO采集海量文本标题,用倒排索引找出“类似的标题“代码实现
  • 模型杂谈:快速上手元宇宙大厂 Meta “开源泄露”的大模型(LLaMA)
  • RedisCluster集群模式下master宕机主从切换期间Lettuce连接Redis无法使用报错Redis command timed out的问题
  • Xuetr杀毒工具使用实验(28)
  • fastapi(https)+openssl+测试(双向校验)
  • TiDB Server
  • S3C2440移植Linux4.19.275内核以及过程中遇到的问题
  • 解忧杂货铺(二):UML时序图
  • 微信小程序的代码由哪些结构组成?
  • Cloud Kernel SIG月度动态:发布 ANCK 新版本及 Plugsched v1.2.0
  • Jedis 使用详解(官方原版)
  • 关于Pytorch中的张量学习
  • 基于Transformer的目标检测算法学习记录
  • 嵌入式学习笔记——使用寄存器编程实现按键输入功能
  • 打卡小达人之路:Spring Boot与Redis GEO实现商户附近查询
  • Apache HTTP Server <2.4.56 mod_proxy_uwsgi 模块存在请求走私漏洞(CVE-2023-27522)
  • JUC并发编程设计模式