cat /etc/issue
Ubuntu 14.04.2 LTS \n \l
内核版本
uname -r
3.16.0-30-generic
相比阿里云,提供3.8.0-44-generic 的内核,ubuntu12,在360云就会好很多了,
备注
Docker is supported on these Ubuntuoperating systems:
Ubuntu Vivid 15.04
Ubuntu Trusty 14.04 (LTS)
Ubuntu Precise 12.04 (LTS)
Ubuntu Saucy 13.10
Kernels older than 3.10 lack some of thefeatures required to run Docker containers. These older versions are known tohave bugs which cause data loss and frequently panic under certain conditions.
如果Kenerl版本小于3.10,那么对docker的支持就会打折扣,甚至运行问题,在阿里云或者您选择较低版本的系统,需要对内核进行升级。话说这年头,程序员何苦为难程序员,直接选择最新版本安装。
进行安装:
sudo apt-getinstall docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will beinstalled:
aufs-toolscgroup-lite git git-manliberror-perl
Suggested packages:
btrfs-tools debootstrap lxc rinse git-daemon-run git-daemon-sysvinitgit-doc
git-el git-email git-gui gitk gitweb git-arch git-bzr git-cvsgit-mediawiki
git-svn
The following NEW packages will beinstalled:
aufs-tools cgroup-litedocker.io gitgit-man liberror-perl
0 upgraded, 6 newly installed, 0 to removeand 124 not upgraded.
Need to get 7,553 kB of archives.
After this operation, 46.6 MB of additionaldisk space will be used.
Do you want to continue? [Y/n]
aufs-toolscgroup-lite git git-manliberror-perl docker.io 这六个就是安装项目,看一下fs这个必须得
安装完毕检查运行状态,因为这个是自启动的:
service docker.io status
docker.io start/running, process 2711
docker默认路径Ubuntu
/var/lib/docker
/etc/apparmor.d/docker
/etc/apparmor.d/cache/docker
/usr/bin/docker
docker -d
2015/08/15 11:45:17 docker daemon: 1.0.1 990021a;execdriver: native; graphdriver:
[86717b03] +job serveapi(unix:///var/run/docker.sock)
[86717b03] +job initserver()
[86717b03.initserver()] Creating server
2015/08/15 11:45:17 Listening for HTTP on unix (/var/run/docker.sock)
[86717b03] +job init_networkdriver()
[86717b03] -job init_networkdriver() = OK (0)
2015/08/15 11:45:17 WARNING: Your kernel does not supportcgroup swap limit.
Loading containers: : done.
[86717b03.initserver()] Creating pidfile
2015/08/15 11:45:17 pid file found, ensure docker is not running or delete /var/run/docker.pid
这时候,建议把pid删除
Cd /var/run
Rm –f docker.pid
重新启动docker –d
新开一个Terminal,然后可以操作docker了
dockerpull ubuntu
02.Pulling repository ubuntu
03.a9561eb1b190: Pulling dependentlayers
04.3db9c44f4520: Downloading[====================> ] 26.42 MB/63.51MB 14m3s
05.c5881f11ded9: Pulling dependentlayers
06.195eb90b5349: Pulling dependentlayers
07.2185fd50e2ca: Pulling dependentlayers
08.463ff6be4238: Pulling dependentlayers
可以看到Docker daemon
下载执行完成后,在Docker daemon输出中也可以看到Job完成
[6aac1773] +job pull(ubuntu, )
[6aac1773] -job pull(ubuntu, ) = OK (0)
执行启动
root@server-zyq9z8tu:~# dockerrun ubuntu /bin/echo "hello"
hello
插播Docker知识分享:
2015/08/15 12:06:53 POST/v1.12/containers/create
[6aac1773] +job create()
[6aac1773] -job create() = OK (0)
2015/08/15 12:06:53
POST /v1.12/containers/fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542/attach?stderr=1&stdout=1&stream=1
[6aac1773] +jobcontainer_inspect(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)
[6aac1773] -jobcontainer_inspect(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)= OK (0)
[6aac1773] +jobattach(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)
2015/08/15 12:06:53 POST/v1.12/containers/fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542/start
[6aac1773] +jobstart(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)
[6aac1773] +joballocate_interface(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)
[6aac1773] -joballocate_interface(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)= OK (0)
[6aac1773] -jobstart(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542) = OK(0)
[6aac1773] +jobrelease_interface(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)
[6aac1773] -jobrelease_interface(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)= OK (0)
[6aac1773] -jobattach(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542) = OK(0)
2015/08/15 12:06:53
POST/v1.12/containers/fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542/wait
[6aac1773] +jobwait(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542)
[6aac1773] -jobwait(fd8c12e250bea198bb8b853202f6910617ea72c2f70b131fa9279f803089b542) = OK (0)
Docker deamon/Driver/Libcontainer/ DockerContainer 这样的四层
root@server-zyq9z8tu:~# docker run -i -tubuntu /bin/bash
root@3c675ff556b6:/# pwd
/
root@3c675ff556b6:/# uname -r
3.16.0-30-generic
root@3c675ff556b6:/#
在JOB Log中可以看到Instance ID
[6aac1773] +job resize(3c675ff556b6eb50bcac558051eb0744167b86d47fcc40cf3ec948c9f25bef59,25, 115)
Exit 退出
使用前的自动拉取,除非你希望使用自己的img;镜像不存在的时候,它会自动的帮你去拉取。例如:
root@server-zyq9z8tu:~# docker run centos /bin/echo 'helloworld'
Unable to find image 'centos' locally
Pulling repository centos
7322fbe74aa5: Pulling dependent layers
f1b10cd84249: Pulling fs layer
f1b10cd84249: Pulling metadata
ubuntu15.04下安装docker:http://www.linuxdiyf.com/linux/12989.html
ubuntu15.04中的docker...2:http://www.linuxdiyf.com/linux/12802.html
ubuntu15.04中的docker...1:http://www.linuxdiyf.com/linux/12797.html
Ubuntu 14.10/15.04安装docker:http://www.linuxdiyf.com/linux/11929.html
Linux系统入门学习:如何在Ubuntu中升级Docker:http://www.linuxdiyf.com/linux/12257.html