1、强大的官方文档
https://docs.docker.com/engine/installation/linux/centos/
2、按步骤来,先更新yum源,这里用163的源
yum install -y wget cd /etc/yum.repos.d wget http://mirrors.163.com/.help/CentOS7-Base-163.repo /usr/bin/yum clean all /usr/bin/yum makecache 其他系统自带的源可以保留,也可以全部干掉
3、更新系统
yum update
4、如果遇到问题:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
yum install -y deltarpm
5、编辑生成docker的yum源文件
tee /etc/yum.repos.d/docker.repo <<-‘EOF‘ [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
6、安装Docker
yum install docker-engine
7、如果遇到问题:Public key for docker-engine-selinux-1.10.1-1.el7.centos.noarch.rpm is not installed,执行下面的命令
rpm --import https://yum.dockerproject.org/gpg
8、Docker下载速度很慢,请耐心等待
9、安装完成后设置开机自启
systemctl enable docker.service
10、启动docker守护进程
systemctl start docker
11、查看docker版本
[[email protected] ~]# docker version Client: Version: 1.12.3 API version: 1.24 Go version: go1.6.3 Git commit: 6b644ec Built: OS/Arch: linux/amd64 Server: Version: 1.12.3 API version: 1.24 Go version: go1.6.3 Git commit: 6b644ec Built: OS/Arch: linux/amd64
12、 Done,enjoy it!
时间: 2024-10-24 21:38:50