本机学习环境为centos7
docker安装
参考文章:http://www.docker.org.cn/book/install/supported-platform-17.html
Docker需要一个64位系统的红帽系统,内核的版本必须大于等于3.10。可以用下面的命令来检查是否满足docker的要求。
1.uname -a 检测你的内核版本是否大于等于3.10
uname -a
Linux w.bitbank.com 3.10.0-327.36.1.el7.x86_64 #1 SMP Sun Sep 18 13:04:29 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
2.更新系统依赖包,sudo yum update
sudo yum update
3.使用脚本方式安装 curl -sSL https://get.docker.com/ |sh
curl -sSL https://get.docker.com/ |sh
docker 安装ubuntu镜像
由于国内网络原因,docker官方镜像库基本无法使用,需要安装镜像以提高pull 下载速度,步骤如下:
1.打开网站 https://www.daocloud.io/ 注册账号,进入https://www.daocloud.io/mirror#accelerator-doc
复制你个人的加速地址,然后在你的docker server上面执行加速脚本即可,xxx地方是你个人分配的一个字符串
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://xxx.m.daocloud.io
#查看是否配置成功
cat /etc/docker/daemon.json
{"registry-mirrors": ["http://xxx.m.daocloud.io"]}
docker helloworld
运行命令 docker run ubuntu echo "hello world"
docker run ubuntu echo "hello world"
进入docker实例
docker run -it ubuntu
查看当前安装的ubuntu版本
cat /etc/os-release
docker与虚拟机的优势区别
1.安装快速简单
2.占用资源少,一台主机可以运行上百个实例
3.可移植性