正在从服务器偷取页面 . . .

服务器搭建Docker环境


服务器搭建docker环境

一. docker的安装

1. 检查内核版本(docker要求系统内核版本高于3.10)

[root@VM-4-8-centos /]# uname -r
3.10.0-1160.11.1.el7.x86_64

2. 下载阿里的镜像源

[root@VM-4-8-centos data]# wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
--2021-06-23 22:28:46--  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 119.96.77.242, 119.96.77.236, 119.96.77.238, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|119.96.77.242|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2081 (2.0K) [application/octet-stream]
Saving to:/etc/yum.repos.d/docker-ce.repo’

100%[==================================================================================================>] 2,081       --.-K/s   in 0s

3. 安装docker-ce

yum install docker-ce -y /* 安装docker-ce(最新版) */
systemctl start docker /* 启动docker */
systemctl enable docker/* 开启自动启动 */

4. 配置docker镜像源

mkdir -p /etc/docker
sudo vi etc/docker/daemon.json

{
    "registry-mirrors": [
        "https://docker.mirrors.ustc.edu.cn",
        "https://registry.docker-cn.com",
        "https://hub-mirror.c.163.com",
        "https://mirror.ccs.tencentyun.com",
        "http://f1361db2.m.daocloud.io"
    ]
}

systemctl daemon-reload /* 重新加载配置文件 */
systemctl restart docker /* 重新启动docker */

5. 查看是否成功

[root@VM-4-8-centos /]# docker info

 Registry Mirrors:
  https://registry.docker-cn.com/
  http://hub-mirror.c.163.com/
  https://docker.mirrors.ustc.edu.cn/
  http://f1361db2.m.daocloud.io/
 Live Restore Enabled: false
 /* Docker就安装好了 */

文章作者:周靖
版权声明:本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 周靖 !
📣 评论
  目录