安装
安装步骤:https://docs.docker.com/linux/step_one/
https://docs.docker.com/engine/installation/linux/ubuntu/
官网推荐的安装步骤已经很详细了,这里只是总结下安装过程遇到的坑
1. 首先需要升级内核版本
因为我用的是阿里云的服务器 内核版本比较低,Docker需要在3.8以上运行
查看系统版本命令 uname -a 或者uname -r
docker 升级内核的步骤:https://docs.docker.com/engine/installation/linux/ubuntulinux/
升级内核命令:
install the backported kernel
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
# install the backported kernel and xorg if using Unity/Xorg
$ sudo apt-get install --install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring
# reboot
$ sudo reboot
这部分参考博客:http://blog.csdn.net/minimicall/article/details/40108305
2.执行官网的安装脚本
$ curl -fsSL https://get.docker.com/ | sh
3.docker启动与验证
改路由表
sudo route del -net 172.16.0.0 netmask 255.240.0.0
启动命令:
sudo service docker start
docker的信息命令
root@master:~# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.10.2
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
Volume: local
Network: bridge null host
Kernel Version: 3.8.0-44-generic
Operating System: Ubuntu precise (12.04.5 LTS)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 993.3 MiB
Name: master
ID: C7PX:OJOD:OEPO:6KA6:WVSH:ULWE:5GOD:EBDZ:EU6A:YHGS:6LL2:ZJAM
root@master:~# Last login: Tue Feb 23 09:31:21 2016 from 101.231.165.18
root@master:~# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.10.2
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
Volume: local
Network: null host bridge
Kernel Version: 3.8.0-44-generic
Operating System: Ubuntu precise (12.04.5 LTS)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 993.3 MiB
Name: master
ID: C7PX:OJOD:OEPO:6KA6:WVSH:ULWE:5GOD:EBDZ:EU6A:YHGS:6LL2:ZJAM
测试hellow-world:docker run hello-world
root@master:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
03f4658f8b78: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/