吉佳 发表于 2015-10-13 09:01:41

阿里云Ubuntu 12.4 64位 安装docker


最近大家都在说docker,索性自己阿里云买了台ubuntu完,这里需要注意的是,docker的官方文档中有提到,docker目前只对64的系统有支持。

所以这里我选择的是ubuntu 12.04 64位.





由于linux容器的bug,docker在linux的kernel3.8上运行最佳。

  

看下我们的ubuntu版本命令:  


root@iZ94742n0oaZ:~# cat /etc/issue
Ubuntu 12.04.5 LTS \n \l



  
  再来看下内核,命令:
  

root@iZ94742n0oaZ:~# uname -r
3.2.0-67-generic


  



  很不幸我的内核版本没有达到官方要求,没关系,我们接下来用下面的命令升级内核:

sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo apt-get install --install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring

注意:升级后需要重启ubuntu.#重启
sudo reboot  




现在我们的环境都准备好,接下来我们要正式的安装部署docker.

首先我们要更新apt-get的安装源



root@iZ94742n0oaZ:~# vi /etc/apt/sources.list
  
  删除里面的所有内容,把下面的安装源写入
  



deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse


  然后更新apt-get
  root@iZ94742n0oaZ:~#apt-get update





root@iZ94742n0oaZ:~#apt-get install docker.io



root@iZ94742n0oaZ:~# service docker.io restart




接下来我们启动docker

root@iZ94742n0oaZ:~#docker run -i -t ubuntu /bin/bash
  Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
  


  root@iZ94742n0oaZ:~#docker run -i -t ubuntu /bin/bash

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?



root@iZ28ikebrg6Z:~# docker -d



出现如下错误:

root@iZ28ikebrg6Z:~# docker -d

Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0'
  然后我们只需要输入:

root@iZ94742n0oaZ:~#sudo route del -net 172.16.0.0 netmask 255.240.0.0
  注意这里,每次重启后都要执行上面这条命令,制定子网掩码。



root@iZ94742n0oaZ:~# docker -d




2015/04/10 15:09:43 docker daemon: 1.0.1 990021a; execdriver: native; graphdriver:
+job serveapi(unix:///var/run/docker.sock)
+job initserver()
Creating server
2015/04/10 15:09:43 Listening for HTTP on unix (/var/run/docker.sock)
+job init_networkdriver()
creating new bridge for docker0
getting iface addr
-job init_networkdriver() = OK (0)
Loading containers: : done.
Creating pidfile
Setting up signal traps
-job initserver() = OK (0)
+job acceptconnections()
-job acceptconnections() = OK (0)
ok,到这里我们的安装算是完成了。

版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: 阿里云Ubuntu 12.4 64位 安装docker