千家信息网

CentOS 6.5如何制作ubuntu 12.04的docker镜像

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,小编给大家分享一下CentOS 6.5如何制作ubuntu 12.04的docker镜像,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!安装docker请看这里:http://my.o
千家信息网最后更新 2026年11月01日CentOS 6.5如何制作ubuntu 12.04的docker镜像

小编给大家分享一下CentOS 6.5如何制作ubuntu 12.04的docker镜像,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

安装docker请看这里:http://my.oschina.net/feedao/blog/222306

前面的文章http://my.oschina.net/feedao/blog/222699,我们创建了centos镜像,这次我们要在

CentOS上制作ubuntu镜像

方法如下:

root:

yum -y install debootstrap

cd /home/admin/

第一次执行:

debootstrap --arch amd64 precise ubuntu-precise http://mirrors.163.com/ubuntu/

报错:no such script /usr/share/debootstrap/scripts/precise
解决办法:
ln -s /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/precise

再次执行:

debootstrap --arch amd64 precise ubuntu-precise http://mirrors.163.com/ubuntu/

修改权限:

chown -R admin.admin ubuntu-precise

切换成admin用户:

su admin

[admin@localhost ~]$ cd ubuntu-precise/

制作ubuntu镜像

[admin@localhost ubuntu-precise]$ tar -c .|docker import - ubuntu1204-base
43ad1b1116dd81b704fddcb803cf5267e6f66f2dd7751b5d2248495f97443705

查看镜像:

[admin@localhost ubuntu-precise]$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu1204-base latest 43ad1b1116dd About a minute ago 172.7 MB
centos63-bash latest d2ecedd2b5ed About an hour ago 306.7 MB

创建ubuntu容器:

[admin@localhost ubuntu-precise]$ docker run -t -i ubuntu1204-base /bin/bash
root@8053e2ca797b:/# pwd
/
root@8053e2ca797b:/# exit
exit

查看当前容器:

[admin@localhost ubuntu-precise]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8053e2ca797b ubuntu1204-base:latest /bin/bash 31 seconds ago Exited (0) 2 seconds ago thirsty_thompson
14c9afaf2f06 centos63-bash:latest /bin/bash About an hour ago Exited (0) About an hour ago insane_lalande

重新启动和进入ubuntu容器:

[admin@localhost ubuntu-precise]$ docker start 8053e2ca797b
8053e2ca797b
[admin@localhost ubuntu-precise]$ docker attach 8053e2ca797b
root@8053e2ca797b:/# ls
bin dev home lib64 mnt proc run selinux sys usr
boot etc lib media opt root sbin srv tmp var

在docker里面运行的ubuntu基础镜像就制作成功了。

看完了这篇文章,相信你对"CentOS 6.5如何制作ubuntu 12.04的docker镜像"有了一定的了解,如果想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!

镜像 制作 容器 篇文章 成功 再次 办法 基础 完了 文章 方法 更多 权限 用户 知识 第一次 行业 请看 资讯 资讯频道 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 互联网佳科技有限公司 金融科技还是互联网 深圳科技互联网 深圳互联网络科技有限公司 互联网科技小贷 互联网 科技创业 互联网科技视频 贷财互联网科技 互联网 视角下的科技创新 湖南洣水互联网科技有限公司扣款 温州喔噻互联网科技有限公司 工业互联网等科技实现智能化赋能 华中科技大学互联网的牛人 众安科技工业互联网合作 深圳无忧互联网科技 21世纪互联网科技成就 容联科技互联网电商 保山互联网科技靠谱吗 东风日产互联网科技公司叫什么 互联网科技企业文化 互联网科技工作委员会毛军 科技金融是不是互联网金融 互联网科技开发公司 互联网之后的科技是什么 深圳育鹏互联网科技有限公司招聘 深圳艾果互联网通讯科技 从那以后互联网科技有限公司 互联网高科技行业有哪些企业 杭州融税互联网科技有限公司 广东猫王互联网科技有限公司电话
0