LXC学习 分类: 软件插件学习 2015-02-05 14:45 176人阅读 评论(0) 收藏
2015-02-05 14:45
267 查看
今天听到同事聊起docker,后来百度了下,说是底层会使用LXC。于是找照猫画虎试验了下
环境:Ubuntu 14.04.1 64
1,安装
sudo apt-get install lxc
报错:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
lxc : Depends: apparmor but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
这里按提示下载apparmor,说已经是最新版本
没有好的办法,于是:
sudo apt-get remove apparmor
sudo apt-get install apparmor
sudo apt-get install lxc
#感觉这样有点危险,担心删除什么重要的东西,还是得找个稳妥的方法
2,检测
lxc-version #检查版本
lxc-checkconfig #判断内核是否支持LXC
这里有个小问题,有这么一项:Cgroup memory controller: missing
不过略过不提,一般的missing还是可以使用的LXC的
3,创建客户机
sudo lxc-create -n lxc-busybox -t busybox
lxc-busybox是创建的容器的名字;
busybox是LXC提供的一种简单的常用模板,看百科貌似也可以自己定义配置文件
4,启动
$ sudo lxc-start -n lxc-busybox
[sudo] password for cloud:
udhcpc (v1.21.1) started
Sending discover...
Sending select for 10.0.3.26...
Lease of 10.0.3.26 obtained, lease time 3600
Please press Enter to activate this console.
#这里Enter就可以进去了,有点简陋
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/ # ^[[22;5Rls
ls
bin etc lib mnt root selinux usr
dev home lib64 proc sbin tmp var
5,关闭
sudo lxc-stop -n lxc-busybox
#这里另开一个命令行界面执行。在容器内部退出的方法暂时没找到
查看百科还有destory销毁之类的命令,暂未实验
查看资料:
http://tieba.baidu.com/p/2248880856 http://baike.baidu.com/link?url=aVty_Fd8zvP01ykqC1RrlrlVh659_RyNZcFxAXQg39bMv6e30P3imWOFB3W3bRK8dFwWuKurGUVdycKc6ToVWa
环境:Ubuntu 14.04.1 64
1,安装
sudo apt-get install lxc
报错:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
lxc : Depends: apparmor but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
这里按提示下载apparmor,说已经是最新版本
没有好的办法,于是:
sudo apt-get remove apparmor
sudo apt-get install apparmor
sudo apt-get install lxc
#感觉这样有点危险,担心删除什么重要的东西,还是得找个稳妥的方法
2,检测
lxc-version #检查版本
lxc-checkconfig #判断内核是否支持LXC
这里有个小问题,有这么一项:Cgroup memory controller: missing
不过略过不提,一般的missing还是可以使用的LXC的
3,创建客户机
sudo lxc-create -n lxc-busybox -t busybox
lxc-busybox是创建的容器的名字;
busybox是LXC提供的一种简单的常用模板,看百科貌似也可以自己定义配置文件
4,启动
$ sudo lxc-start -n lxc-busybox
[sudo] password for cloud:
udhcpc (v1.21.1) started
Sending discover...
Sending select for 10.0.3.26...
Lease of 10.0.3.26 obtained, lease time 3600
Please press Enter to activate this console.
#这里Enter就可以进去了,有点简陋
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/ # ^[[22;5Rls
ls
bin etc lib mnt root selinux usr
dev home lib64 proc sbin tmp var
5,关闭
sudo lxc-stop -n lxc-busybox
#这里另开一个命令行界面执行。在容器内部退出的方法暂时没找到
查看百科还有destory销毁之类的命令,暂未实验
查看资料:
http://tieba.baidu.com/p/2248880856 http://baike.baidu.com/link?url=aVty_Fd8zvP01ykqC1RrlrlVh659_RyNZcFxAXQg39bMv6e30P3imWOFB3W3bRK8dFwWuKurGUVdycKc6ToVWa
相关文章推荐
- ubuntu中安装virtualbox碰到的问题 分类: 软件插件学习 2014-12-17 17:46 189人阅读 评论(0) 收藏
- Fuel 30 分钟快速安装openstack 分类: 软件插件学习 2014-12-19 11:44 268人阅读 评论(0) 收藏
- 短小精悍:LinuxMint/Ubuntu实用小软件 分类: 软件插件学习 2015-04-30 16:34 68人阅读 评论(0) 收藏
- ubuntu14.04安装docker 分类: 软件插件学习 2015-02-10 09:20 260人阅读 评论(0) 收藏
- MD5+Salt安全浅析 分类: 软件插件学习 2015-05-08 11:34 41人阅读 评论(0) 收藏
- 如何在 KVM 虚拟机上运行 KVM 分类: 软件插件学习 2014-12-01 16:18 162人阅读 评论(0) 收藏
- ubuntu14.04安装深度音乐+百度音乐插件 分类: ubuntu学习 软件插件学习 2015-04-16 18:35 108人阅读 评论(0) 收藏
- Django:快速搭建简单的Blog 分类: 软件插件学习 2015-06-10 18:07 35人阅读 评论(0) 收藏
- ubuntu12.04更换JDK 分类: 软件插件学习 2015-03-31 19:32 146人阅读 评论(0) 收藏
- ubuntu14.04安装krita 分类: 软件插件学习 2015-04-29 20:56 163人阅读 评论(0) 收藏
- gluster存储改变ip段 分类: 软件插件学习 2014-12-01 15:21 163人阅读 评论(0) 收藏
- Eclipse快捷键 10个最有用的快捷键 分类: 软件插件学习 2014-08-22 14:39 144人阅读 评论(0) 收藏
- Docker的save和export命令的区别 分类: 软件插件学习 2015-03-03 13:47 125人阅读 评论(0) 收藏
- docker继续学习——一些简单操作 分类: 软件插件学习 2015-02-12 16:10 113人阅读 评论(0) 收藏
- wget 命令用法详解 分类: ubuntu学习 软件插件学习 2014-10-17 09:27 175人阅读 评论(0) 收藏
- 一个服务器上部署两个FTP服务 分类: 软件插件学习 2014-12-25 11:05 129人阅读 评论(0) 收藏
- ubuntu上git学习 分类: 软件插件学习 2014-12-25 10:33 144人阅读 评论(0) 收藏
- 软件开发过程学习笔记(三)之概要设计说明书模板 分类: 开发过程 2015-07-08 14:45 14人阅读 评论(0) 收藏
- 如何辨别密码安全糟糕的网站 分类: 软件插件学习 2015-05-08 11:32 54人阅读 评论(0) 收藏
- GlusterFS 安装与配置 分类: 软件插件学习 2014-09-11 09:42 348人阅读 评论(0) 收藏