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

360云 Ubuntu安装Dokcer

时间:2017-06-14 16:26:45      阅读:313      评论:0      收藏:0      [点我收藏+]

标签:btrfs   hello   拉取   lan   低版本   wiki   选择   amp   not   

??

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

标签:btrfs   hello   拉取   lan   低版本   wiki   选择   amp   not   

原文地址:http://www.cnblogs.com/ljbguanli/p/7008561.html

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