阿里云cenos 6.5 模板上安装 docker
本章将介绍在阿里云的 Centos6.5 模板上安装 Docker 以及在 Ubuntu 14.04 模板上安装 Docker 的过程
Centos 6.5 模板上使用Docker
首先,通过 ssh 登陆阿里云的server,查看系统版本号号以及内核版本号。
Welcome to aliyun Elastic Compute Service!
# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
# uname -a
Linux xxxxxxx 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
升级内核
由于 Docker 推荐使用 3.8 以上内核。所以我们选择使用 YUM 方式来升级内核。
导入 KEY ,安装软件源。在 YUM 的 ELRepo 源中,有 mainline(3.13.1)、long-term(3.10.28)这 2 个内核版本号。考虑到 long-term 更稳定,会长期更新。所以选择这个版本号。
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# yum --enablerepo=elrepo-kernel install kernel-lt -y
Loaded plugins: security
base | 3.7 kB 00:00
base/primary_db | 4.6 MB 00:00
elrepo | 2.9 kB 00:00
elrepo/primary_db | 709 kB 00:46
elrepo-kernel | 2.9 kB 00:00
elrepo-kernel/primary_db | 20 kB 00:01
epel | 4.4 kB 00:00
epel/primary_db | 6.3 MB 00:01
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 181 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-lt.x86_64 0:3.10.59-1.el6.elrepo will be installed
--> Finished Dependency ResolutionDependencies Resolved=====================================================================================================================================================Package Arch Version Repository Size
=====================================================================================================================================================
Installing:kernel-lt x86_64 3.10.59-1.el6.elrepo elrepo-kernel 33 MTransaction Summary
=====================================================================================================================================================
Install 1 Package(s)Total download size: 33 M
Installed size: 153 M
Downloading Packages:
kernel-lt-3.10.59-1.el6.elrepo.x86_64.rpm | 33 MB 28:58
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.Installing : kernel-lt-3.10.59-1.el6.elrepo.x86_64 1/1Verifying : kernel-lt-3.10.59-1.el6.elrepo.x86_64 1/1Installed:kernel-lt.x86_64 0:3.10.59-1.el6.elrepoComplete!
vi /etc/grub.conf
改动默认的启动内核。新安装的内核一般在第一个,这里把default = 1
改为 default = 0
就好了。
default=1
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.10.59-1.el6.elrepo.x86_64)root (hd0,0)kernel /boot/vmlinuz-3.10.59-1.el6.elrepo.x86_64 ro root=UUID=94e4e384-0ace-437f-bc96-057dd64f42ee rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quietinitrd /boot/initramfs-3.10.59-1.el6.elrepo.x86_64.img
title CentOS (2.6.32-431.23.3.el6.x86_64)root (hd0,0)kernel /boot/vmlinuz-2.6.32-431.23.3.el6.x86_64 ro root=UUID=94e4e384-0ace-437f-bc96-057dd64f42ee rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quietinitrd /boot/initramfs-2.6.32-431.23.3.el6.x86_64.img
~
重新启动云主机,查看内核是否升级成功。
# uname -a
Linux xxxxxxx 3.10.59-1.el6.elrepo.x86_64 #1 SMP Thu Oct 30 23:46:31 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
安装 Docker
安装软件源,安装 Docker 软件。
# yum install http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm
# yum install docker-io
启动 Docker
安装寻常的方法启动 Docker 之后,发现仍然提示有问题。
# service docker start
Starting cgconfig service: [ OK ]
Starting docker: [ OK ]
# docker version
Client version: 1.2.0
Client API version: 1.14
Go version (client): go1.3.3
Git commit (client): fa7b24f/1.2.0
OS/Arch (client): linux/amd64
2014/11/05 21:03:08 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
使用 docker -d
来查看具体的启动过程。
# docker -d
2014/11/05 21:10:56 docker daemon: 1.2.0 fa7b24f/1.2.0; execdriver: native; graphdriver:
[40a2dcc2] +job serveapi(unix:///var/run/docker.sock)
[info] Listening for HTTP on unix (/var/run/docker.sock)
[40a2dcc2] +job init_networkdriver()
[40a2dcc2.init_networkdriver()] creating new bridge for docker0
Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0'
[40a2dcc2] -job init_networkdriver() = ERR (1)
2014/11/05 21:10:56 Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0'
提示我们没有空余 ip
分配给 docker0
了。
那我们就使用 --bip
參数来手工分配给 ip 地址。
比方:
# docker --bip=192.168.100.1/24 -d &
[2] 2388
[root@iZ23pznlje4Z ~]# 2014/11/05 21:16:55 docker daemon: 1.2.0 fa7b24f/1.2.0; execdriver: native; graphdriver:
[dc6906e7] +job serveapi(unix:///var/run/docker.sock)
[info] Listening for HTTP on unix (/var/run/docker.sock)
[dc6906e7] +job init_networkdriver()
[dc6906e7] -job init_networkdriver() = OK (0)
2014/11/05 21:16:55 WARNING: Your kernel does not support cgroup swap limit.
[info] Loading containers:
[info] : done.
[dc6906e7] +job acceptconnections()
[dc6906e7] -job acceptconnections() = OK (0)
这里提示警告 Your kernel does not support cgroup swap limit.
。我们能够使用 lxc-checkconfig
来检查。
# lxc-checkconfig
Kernel configuration not found at /proc/config.gz; searching...
Kernel configuration found at /boot/config-3.10.59-1.el6.elrepo.x86_64
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: missing
Network namespace: enabled
Multiple /dev/pts instances: enabled--- Control groups ---
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabledNote : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
能够看到 Control groups
项目都是支持的,所以我们临时忽略这个告警。
測试使用
由于 Aliyun 的网络直接 pull 官方镜像也不是非常稳定,这里推荐使用Dockerpool
官方站点的标准ubuntu
镜像来測试。
下载镜像,又一次标记镜像。
# docker pull dl.dockerpool.com:5000/ubuntu:14.04
# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dl.dockerpool.com:5000/ubuntu latest 5506de2b643b 12 days ago 197.8 MB
# docker tag 550 ubuntu
# docker rmi dl.dockerpool.com:5000/ubuntu
[dc6906e7] +job image_delete(dl.dockerpool.com:5000/ubuntu)
[dc6906e7] +job log(untag, 5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5, )
[dc6906e7] -job log(untag, 5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5, ) = OK (0)
[dc6906e7] -job image_delete(dl.dockerpool.com:5000/ubuntu) = OK (0)
Untagged: dl.dockerpool.com:5000/ubuntu:latest
启动容器,并測试网络。
# docker run -ti ubuntu
root@66ff9a55a4f5:/# ping www.dockerpool.com
PING www.dockerpool.com (xxx.xxx.xxx.xxx) 56(84) bytes of data.
^C64 bytes from 203.195.193.251: icmp_seq=1 ttl=47 time=31.4 ms
转载于:https://www.cnblogs.com/lxjshuju/p/6913807.html
阿里云cenos 6.5 模板上安装 docker相关推荐
- 在阿里云主机的Debian操作系统上安装Docker
## 下面命令都是以root用户执行## 查看内核版本 uname -a # Debian 3.2.0-4 x86_64 ## 版本太低了 < 3.8 ## 参照 http://docs.doc ...
- Centos7安装docker并更改阿里云下载镜像地址(附带windows10安装docker教程)
文章目录 1. 删除阿里云自带的docker 2. 下载docker依赖包 3. 下载docker仓库 4. 下载docker社区版,客户端,镜像 5. 安装成功查看版本 6. 更换下载地址为阿里云 ...
- 【阿里云】在CentOS7系统上安装MySQL8
# 1.卸载MariaDB ## 1.1 查看版本 [~]~ rpm -qa|grep mariadb mariadb-libs-5.5.68-1.el7.x86_64 ## 1.2 卸载 [~]~ ...
- 阿里云centos环境之linux上redis安装及踩过的坑(七)
阿里云centos环境之linux上redis安装及踩过的坑<七> 文章目录 阿里云centos环境之linux上redis安装及踩过的坑<七> 第一:下载上传 第二:解压安装 ...
- 在阿里云HPC和容器服务上,像梵高一样作画
本系列将利用Docker技术在阿里云HPC和容器服务上,帮助您上手TensorFlow的机器学习方案 第一篇:打造TensorFlow的实验环境 第二篇:轻松搭建TensorFlow Serving集 ...
- 阿里云免费SSL证书申请与安装使用-附Nginx,Apache,IIS 6,IIS 8配置SSL教程
大家直接跳转吧:http://www.07net01.com/2017/01/1795676.html 也许是看到了Https是未来发展的大趋势,Symantec 和GeoTrust 两大SSL公司最 ...
- 第二章:阿里云ECS服务器(G5)安装配置docker
个人简介: 我是廖志伟,一名Java开发工程师,CSDN博客专家,多年一线研发经验,曾就职多家互联网公司,参与并主导多个百万级并发的互联网产品研发与系统架构搭建,对大型分布式,高并发及微服务架构,缓存 ...
- python程序发布到阿里云云服务器_Python实现阿里云服务器里的文件上传与下载
Python实现阿里云服务器里的文件上传与下载 018.4.15 背景: 老实说,因为现实的各种原因造成电脑换来换去是可能出现的事情,但是电脑能换,电脑里的环境却不能换.我就曾在三个电脑里各自安装了虚 ...
- 阿里云存储OSS中设置上传文件content type
阿里云存储OSS中设置上传文件ContentType 如果你使用浏览器上传文件,则浏览器会自动在header中设置正确地content type,然后对文件的访问会得到正确地回应. 如果采用编程的方式 ...
最新文章
- opencv使用cvFindContours提取联通域
- Python培训分享:Python新版本中的6个新特性
- 腾讯告诉你小孩子的钱也有多好赚,一月花费25万不是梦!
- Android开发之android_apk 在线安装(源代码分享)
- linux 7个运行级别 runlevel 简介
- php生成 sku_高并发下,php与redis实现的抢购、秒杀功能
- mysql压力写入测试_mysql压力测试工具
- matlab求曲线极值程序,matlab函数求极值matlab函数求极值.ppt
- cocos2d pod_cocos2d 和 cocos3d的版本问题
- mysql replace into +1_mysql replace into用法详细说明
- C#简单银行管理系统
- MATLAB(6)GUI应用介绍
- Vue概述和各种前端框架
- CDSN获取积分的攻略
- Processing编程入门-02——添加图片 小游戏
- wannafly summer camp day6
- 论文阅读_DEVFormer
- 100V输出12V/10A,5V/3.1ADC-DC异步降压芯片
- StarlingX 补丁升级功能
- 一款查找并删除电脑中重复文件/图片/视频的软件
热门文章
- openfiledialog选择文件会占用文件_铁皮文件柜的尺寸规格如何选择?选购花都文件柜要注意的问题...
- 器件旋转45度_【速评3+1】第十一期:朱雨玲45,日版CL,Rakza Z,国变等
- python画图xlable显示中文_xlabel和ylabel超出绘图区域,无法在figu中完全显示
- web前后台数据交互的四种方式
- idea 高级调试技巧
- github fork别人项目后如何同步更新原项目
- 电脑访问不了部分网站|Internet属性
- c语言i o编程,【linux】基本I/O操作标准I/O操作(c语言编程)
- 人工智能建立本体库_本体:一文读懂领域本体构建
- jquery操作文档节点的属性