360雲 Ubuntu安裝Dokcer



360Ubuntu安裝Dokcer

cat /etc/issuegit

Ubuntu 14.04.2 LTS \n \lweb

內核版本號docker

uname -rbootstrap

3.16.0-30-genericubuntu

相比阿里雲,提供3.8.0-44-generic  的內核,ubuntu12。在360雲就會好很是多了,centos

備註api

Docker is supported on these Ubuntuoperating systems:bash

  • Ubuntu Vivid 15.04app

  • Ubuntu Trusty 14.04 (LTS)svn

  • 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

     


相關文章
相關標籤/搜索