Docker系列2——Docker安装
本文最后更新于 534 天前,如有失效请评论区留言。

前提条件

Linux 是Docker 安装前提条件,我这里使用的是CentOS系统,目前CentOS 仅发行版本中的内核支持 Docker,要求系统为64位、Linux系统内核版本为 3.8以上,这里选用 Centos7.x ,查看自己的内核uname命令用于打印当前系统相关信息(内核版本号、硬件架构、主机名称和操作系统类型等)。

  • 安装的Docker版本:Docker version 27.0.3

官网

官网:docker官网
仓库:Docker Hub官网

安装步骤

centos 安装docker官网步骤
为了方便查阅,这里我还是贴出来方便一些

查看系统版本

cat /etc/redhat-release

卸载旧版本

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

yum安装gcc相关

1、centos能链接外网
2、安装gcc依赖
yum -y install gcc
yum -y install gcc-c++

安装需要的软件包

yum install -y yum-utils

设置stable镜像仓库

#大坑:官网给的国外镜像仓库,我们根本连不上。
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
 报错:1   [Errno 14] curl#35 - TCP connection reset by peer  2   [Errno 12] curl#35 - Timeout

#推荐使用国内镜像仓库:
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

更新yum软件包索引

yum makecache fast

安装docekr-ce

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

启动docker

systemctl start docker

测试

运行一个Hello-world

docker version
docker run hello-world

卸载

这里就不需要执行了,只是写在这里。

systemctl stop docker 
yum remove docker-ce docker-ce-cli containerd.io
rm -rf /var/lib/docker
rm -rf /var/lib/containerd

阿里云镜像加速:

是什么:https://promotion.aliyun.com/ntms/act/kubernetes.html

注册一个阿里云账号(可复用淘宝账号)

获取加速器地址连接

登录阿里云开发者平台-->点击控制台-->选择容器镜像服务-->获取加速器地址

{
  "registry-mirrors": ["https://skg9ytev.mirror.aliyuncs.com"]
}

这是我的阿里云加速地址,要更换成自己的。

添加加速器配置

vim  /etc/docker/daemon.json
{
  "registry-mirrors": ["https://skg9ytev.mirror.aliyuncs.com"]
}

重启服务器

systemctl daemon-reload
systemctl restart docker
版权声明:除特殊说明,博客文章均为cuckooyang原创,依据CC BY-SA 4.0许可证进行授权,转载请附上出处链接及本声明。 | 博客订阅:RSS | 广告招租:留言板 | 博客VPS |
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇