文章目录
1. CentOS安装
1.1. 系统要求
目前,CentOS 仅发行版本中的内核支持 Docker。
- CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上
- CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本
检查内核版本方法:
$ uname -r
3.10.0-327.el7.x86_64
1.2. yum安装
执行命令
# 安装docker
$ yum -y install docker
# 启动docker
$ service docker start
1.3. 脚本安装
- 使用 sudo 或 root 权限登录 Centos
- 确保 yum 包更新到最新
$ sudo yum update
- 执行 Docker 安装脚本
$ curl -fsSL https://get.docker.com/ | sh
#执行这个脚本会添加 docker.repo 源并安装 Docker。
- 启动 Docker 进程。
$ sudo service docker start
- 验证 docker 是否安装成功并在容器中执行一个测试的镜像
$ sudo docker run hello-world
到此,docker 在 CentOS 系统的安装完成。
2. Ubuntu 安装
2.1. 系统要求
- 64位系统
- 内核版本3.10以上
检查内核版本方法:
$ uname -r
4.4.0-21-generic
2.2. 添加镜像源
# 切换到root
$ sudo su root
# 安装 apt-transport-https 包支持https协议的源
$ apt-get install apt-transport-https ca-certificates
#添加源的gpg密钥
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# 获取当年系统代号
$ lsb_release -c
Codename: xenial
# 添加镜像源 并 修改为系统代号 ubuntu-系统代号
$ sudo cat <<EOF> /etc/apt/sources.list.d/docker.list
$ deb https://apt.dockerproject.org/repo ubuntu-xenial main
$ EOF
$ sudo apt-get update
2.3. apt 安装
$ apt-get install -y --allow-unauthenticated docker-engine
$ sudo service docker start
2.4. 官方脚本安装
$ curl -fsSL https://get.docker.com/ | sh
#执行这个脚本会添加 docker.repo 源并安装 Docker。
3. Windows安装
装个虚拟机然后再虚拟机里装吧 _