先说Debia
:~# apt-get install docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package docker-ce
于是乎
:~# apt update
:~# apt-get upgrade
再安装,问题依旧。。。
方法:
1、让apt支持HTTPS
apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
2、添加Docker的官方密钥
国外 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
国内 curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -
3、查看本机的系统架构
:~# dpkg --print-architecture amd64
4、写入更新源
国外 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
国内 add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian $(lsb_release -cs) stable"
5、然后再来执行安装
apt-get update apt-get install docker-ce
6、查看版本
docker version
------------
如果写入更新源写错了,改这个文件
/etc/apt/sources.list
一键安装脚本
#CentOS 6系统
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update -y
yum -y install docker-io
service docker start
chkconfig docker on
#CentOS 7、Debian、Ubuntu系统
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker