码迷,mamicode.com
首页 > 系统相关 > 详细

360云 Ubuntu安装Dokcer

时间:2015-08-15 15:02:11      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:



360Ubuntu安装Dokcer

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

     



版权声明:本文为博主原创文章,未经博主允许不得转载。

360云 Ubuntu安装Dokcer

标签:

原文地址:http://blog.csdn.net/gnicky/article/details/47681201

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!