CentOS7 安装 Docker,10分钟入门!

时间:2023-03-09 13:44:14
CentOS7 安装 Docker,10分钟入门!

本次安装是在VM虚拟机的CentOS 7环境下,仅为了学习和测试的简单安装,如果在真实生产环境还需要考虑安全策略的其他问题。

1、Linux内核版本需要 3.10.0 以上并且是64位

[root@localhost ~]# uname -r
3.10.0-693.2.2.el7.x86_64

2、更新软件包

[root@localhost ~]# yum update

3、添加yum源

[root@localhost ~]# cat /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=
gpgcheck=
gpgkey=https://yum.dockerproject.org/gpg

4、安装Docker

[root@localhost ~]# install docker-engine

5、安装完成测试

[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
……
……
……

完成!