部署docker容器虚拟化平台

环境: 阿里云服务器 CENTOS7.6   64位                                            

[root@localhost ~]# uname -a
Linux localhost 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

1、安装docker环境依赖

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2

2、配置国内docker的yum源 

网易163yum源,安装方法查看:http://mirrors.163.com/.help/
中科大yum源,安装方法查看:https://lug.ustc.edu.cn/wiki/mirrors/help
搜狐yum源,安装方法查看: http://mirrors.sohu.com/help/
阿里云yum源,安装方法查看: https://mirrors.aliyun.com/
清华yum源,安装方法查看: https://mirrors.tuna.tsinghua.edu.cn/
浙大yum源,安装方法查看: http://mirrors.zju.edu.cn/
科大yum源,安装方法查看: http://centos.ustc.edu.cn/
方法一:
a.备份yum默认仓库文件 [root@localhost ~]# cd /etc/yum.repos.d   ---进入仓库目录

[root@localhost ~]# mv CentOS-Base.repo CentOS-Base.repo.backup ---备份默认源文件
b.下载国内仓库源文件
[root@localhost ~]# wget -O ./CentOS-Base.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 下载后执行以下两条命令 
[root@localhost ~]# yum clean all ---清空缓存 

[root@localhost ~]# yum makecache ---生成缓存
方法二:
[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3、安装docker-ce:

[root@localhost ~]# yum install docker-ce docker-ce-cli containerd.io -y
docker-ce-cli 是docker命令行工具包,containerd.io 是容器接口相关包
yun info 软件包的命令,可以查看一个包的具体作用
[root@localhost ~]# yum info docker-ce docker-ce-cli containerd.io Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Installed Packages Name : containerd.io ... Description : containerd is an industry-standard container runtime with an emphasis on : simplicity, robustness and portability. It is available as a daemon for Linux : and Windows, which can manage the complete container lifecycle of its host : system: image transfer and storage, container execution and supervision, : low-level storage and network attachments, etc. Name : docker-ce .... Description : Docker is a product for you to build, ship and run any application as a : lightweight container. : : Docker containers are both hardware-agnostic and platform-agnostic. This means : they can run anywhere, from your laptop to the largest cloud compute instance and : everything in between - and they don't require you to use a particular : language, framework or packaging system. That makes them great building blocks : for deploying and scaling web apps, databases, and backend services without : depending on a particular stack or provider. Name : docker-ce-cli ... Description : Docker is is a product for you to build, ship and run any application as a : lightweight container. : : Docker containers are both hardware-agnostic and platform-agnostic. This means : they can run anywhere, from your laptop to the largest cloud compute instance and : everything in between - and they don't require you to use a particular : language, framework or packaging system. That makes them great building blocks : for deploying and scaling web apps, databases, and backend services without : depending on a particular stack or provider.

4、启动并且设置开机自启

[root@localhost ~]# systemctl start docker && systemctl enable docker

5、显示 Docker 版本信息

[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 20.10.12

Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12

6、查看 docker 信息

[root@localhost ~]# docker info #
Client:
...

Server:
...
Server Version: 20.10.12
...
Plugins: 
...
Docker Root Dir: /var/lib/docker ##默认的docker的家目录
...
Live Restore Enabled: false 

至此,docker环境搭建完成!            

                                                          

 

上一篇:docker安装tomcat以及出现的问题404解决[源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示]


下一篇:curl 命令上传文件