阿里云部署Docker(5)----管理和发布您的镜像
出到这节,我在百度搜索了一下“阿里云部署Docker”,突然发现怎么会有人跟我写的一样呢?哦,原来是其他博客系统的爬虫来抓取,然后也不会写转载自什么什么的。所以,我终于明白为什么那些大咖的文章总会在文章的开头写明,转载请注明原创来自xxx的。恩。get it,从这篇开始,我也要这样了。
本文欢迎转载,但要尊重本人劳动成果,转载注明转自“http://blog.csdn.net/minimicall/” http://blog.csdn.net/minimicall/article/details/40147207
对阿里云里面部署Docker,我的之前的文章有:
第一篇,安装篇:http://blog.csdn.net/minimicall/article/details/40108305
第二篇,依旧是安装:http://blog.csdn.net/minimicall/article/details/40119177
第三篇,基础指令学习:http://blog.csdn.net/minimicall/article/details/40143061
第四篇,容器的使用:http://blog.csdn.net/minimicall/article/details/40144719
今天,我们要进一步讲解,
管理本地镜像
创建基础镜像
上传发布镜像
Listing images on the host
我们首先通过 docker images来查看一下我们本地有什么镜像。
root@iZ28ikebrg6Z:~# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu utopic 2185fd50e2ca 2 days ago 237.2 MB
ubuntu 14.10 2185fd50e2ca 2 days ago 237.2 MB
ubuntu trusty 9cbaf023786c 2 days ago 192.8 MB
ubuntu 14.04 9cbaf023786c 2 days ago 192.8 MB
ubuntu 14.04.1 9cbaf023786c 2 days ago 192.8 MB
ubuntu latest 9cbaf023786c 2 days ago 192.8 MB
ubuntu 12.04.5 a9561eb1b190 2 days ago 120.2 MB
ubuntu precise a9561eb1b190 2 days ago 120.2 MB
ubuntu 12.04 a9561eb1b190 2 days ago 120.2 MB
centos latest 87e5b6b3ccc1 2 weeks ago 224 MB
ubuntu 12.10 c5881f11ded9 3 months ago 172.2 MB
ubuntu quantal c5881f11ded9 3 months ago 172.2 MB
ubuntu 13.04 463ff6be4238 3 months ago 169.4 MB
ubuntu raring 463ff6be4238 3 months ago 169.4 MB
ubuntu saucy 195eb90b5349 3 months ago 184.7 MB
ubuntu 13.10 195eb90b5349 3 months ago 184.7 MB
training/webapp latest 31fa814ba25a 4 months ago 278.8 MB
ubuntu lucid 3db9c44f4520 5 months ago 183 MB
ubuntu 10.04 3db9c44f4520 5 months ago 183 MB
可以看到,我在之前的教程里面拉取了两个一个是ubuntu,一个是training/webapp。其中ubuntu,docker给我拉取了那么多变种回来。上面的输出有一列叫“TAG”,记得我们运行的时候会有"docker run ubuntu:14.04 /bin/bash 么 !就是根据TAG来精确的指定我们想要执行的那个ubuntu,否则docker会自作聪明的运行TAG为“latest”的那个镜像。
Getting a new image
如何获取一个新的镜像。我们知道当我们运行一个镜像的时候,如果这个镜像例如centos在本地没有,docker会自动的去远端库查询和下载。但是这种临时的下载明显是费时间的,我们可以不可以提前去下载呢?可以,使用docker pull拉取指令。
root@iZ28ikebrg6Z:~# docker pull centos
Pulling repository centos
^Croot@iZ28ikebrg6Z:~# ^C
你看,它会去拉取,不过我中断了,因为我不需要,我的阿里云存储很金贵的。
Finding images
搜索一个镜像,你可以选择去docker hub的网站搜索,也可以选择在本地用命令行的方式进行。
如下:
root@iZ28ikebrg6Z:~# docker search redmine
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
sameersbn/redmine 40 [OK]
webts/redmine Self contained Redmine 2.4 install on Cent... 2
triangle/redmine-plugin-dev Redmine 2.4.1 on ruby 2.0 aimed at plugin ... 1 [OK]
oasis/redmine-git 1
melopos/redmine 1 [OK]
turnkeylinux/redmine-13.0 TurnKey Redmine - Integrated SCM & Project... 1
sherkenh/redmine 0
oasis/redmine 0
bernigaud/redmine Redmine for my server HAL Forked from same... 0
eprecise/redmine 0
hogefoobar/redmine 0
mattuso/redmine_nginx 0 [OK]
mattuso/redmine_mysql 0 [OK]
aofox5152/redmine 0
chonglou/redmine remine+mysql+nginx 0
laughk/redmine 0
krickwix/redmine 0
bazitov/redmine 0
sasasin/redmine-scrum ALMinium on CentOS 6, with SSH server. 0
yjkim/apache-redmine 0
sosyco/redmine-sqlite-debian Tryout/GetAndRun Redmine 2.5.1/sqlitel/De... 0
eternnoir/redminebot 0 [OK]
sosyco/redmine-mysql-debian Tryout/GetAndRun Redmine 2.5.1/mysql/Debi... 0
hiromiso/redmine2.4 redmine + mysql 0
tmtkd/redminetest Sep. 1st, 2014 test of redmine/docker 0
pvdvreede/redminedev Installation of ruby 2.0.0-p247 and others 0
madmaze/ubunturedmine quick ubuntu 12.04 image with Redmine on s... 0
shaftoe/new_redmine WARNING: old legacy Redmine, not usable fo... 0
mattuso/redmine_unicorn 0 [OK]
vpetersson/redmine 0 [OK]
miraitechno/redmine 0 [OK]
pnelson/redmine 0 [OK]
padelt/redmine 0 [OK]
binaryphile/redmine Reusable, general-purpose Redmine instance... 0
我们搜索了一下redmine,这是个项目管理的服务。上面的列 有,名字,描述,星级(越流行评分越高,提供参考),是否有官方维护,是否自动化,这点我不是很能理解,我也不敢误人子弟。所以还是引用官网的那句话,各位看官自己理解
“Official repositories are built and maintained by the Stackbrew project, and Automated repositories are Automated Builds that allow you to validate the source and content of an image.”
选一个pull下来就行了。
Building an image from a Dockerfile
通过Dockerfile来构建一个镜像。用vim写一个Dockerfile,内如如下:
#This is a comment
FROM ubuntu:14.04
MAINTAINER zengjinlong <470910357@qq.com>
RUN apt-get update && apt-get install -y ruby ruby-dev
RUN gem install sinatra
命令都是大写,FROM表示它的源是什么,例如我们这个是给予Ubuntu:14.04的,MAINTANER是维护人员,比如说我,小曾,卖下萌。
RUN表示执行指令。
好,执行上述Dockerfile。
root@iZ28ikebrg6Z:~/docker# docker build -t="zengjinlong/sinatra:v2" .
Sending build context to Docker daemon 2.56 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:14.04---> 9cbaf023786c
Step 1 : MAINTAINER zengjinlong <470910357@qq.com>---> Running in c5674e71d7e4---> 224b40d4b89f
Removing intermediate container c5674e71d7e4
Step 2 : RUN apt-get update && apt-get install -y ruby ruby-dev---> Running in 5d6373cb79e6
Ign http://archive.ubuntu.com trusty InRelease
Ign http://archive.ubuntu.com trusty-updates InRelease
Ign http://archive.ubuntu.com trusty-security InRelease
Ign http://archive.ubuntu.com trusty-proposed InRelease
Get:1 http://archive.ubuntu.com trusty Release.gpg [933 B]
Get:2 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
Get:3 http://archive.ubuntu.com trusty-security Release.gpg [933 B]
Get:4 http://archive.ubuntu.com trusty-proposed Release.gpg [933 B]
Get:5 http://archive.ubuntu.com trusty Release [58.5 kB]
Get:6 http://archive.ubuntu.com trusty-updates Release [59.7 kB]
Get:7 http://archive.ubuntu.com trusty-security Release [59.7 kB]
Get:8 http://archive.ubuntu.com trusty-proposed Release [110 kB]
Get:9 http://archive.ubuntu.com trusty/main Sources [1335 kB]
会耗费比较长的时间。
我们技术下一步的学习。
标记一个image
docker tag 5db5f8471261 ouruser/sinatra:devel
root@iZ28ikebrg6Z:~/docker# docker tag 224b40d4b89f zengjinlong/sinatra:v3
结果显示一下,
输出:
root@iZ28ikebrg6Z:~/docker# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<strong><span style="color:#ff0000;">zengjinlong/sinatra v3 </span></strong> 224b40d4b89f 13 minutes ago 192.8 MB
ubuntu 14.10 2185fd50e2ca 2 days ago 237.2 MB
ubuntu utopic 2185fd50e2ca 2 days ago 237.2 MB
ubuntu trusty 9cbaf023786c 2 days ago 192.8 MB
ubuntu latest 9cbaf023786c 2 days ago 192.8 MB
ubuntu 14.04.1 9cbaf023786c 2 days ago 192.8 MB
ubuntu 14.04 9cbaf023786c 2 days ago 192.8 MB
ubuntu precise a9561eb1b190 2 days ago 120.2 MB
ubuntu 12.04.5 a9561eb1b190 2 days ago 120.2 MB
ubuntu 12.04 a9561eb1b190 2 days ago 120.2 MB
centos centos5 504a65221a38 2 weeks ago 467.1 MB
centos centos6 68edf809afe7 2 weeks ago 212.7 MB
centos centos7 87e5b6b3ccc1 2 weeks ago 224 MB
centos latest 87e5b6b3ccc1 2 weeks ago 224 MB
ubuntu quantal c5881f11ded9 3 months ago 172.2 MB
ubuntu 12.10 c5881f11ded9 3 months ago 172.2 MB
ubuntu 13.04 463ff6be4238 3 months ago 169.4 MB
ubuntu raring 463ff6be4238 3 months ago 169.4 MB
ubuntu saucy 195eb90b5349 3 months ago 184.7 MB
ubuntu 13.10 195eb90b5349 3 months ago 184.7 MB
training/webapp latest 31fa814ba25a 4 months ago 278.8 MB
ubuntu 10.04 3db9c44f4520 5 months ago 183 MB
ubuntu lucid 3db9c44f4520 5 months ago 183 MB
上传我们的镜像到docker hub里面。
root@iZ28ikebrg6Z:~/docker# docker push zengjinlong/sinatra
The push refers to a repository [zengjinlong/sinatra] (len: 1)
Sending image list
^Croot@iZ28ikebrg6Z:~/docker#
演示一下就OK,不是很想在这里浪费时间。
删除本地镜像,因为毕竟占地方把。
root@iZ28ikebrg6Z:~/docker# docker rmi centos
Untagged: centos:latest
root@iZ28ikebrg6Z:~/docker# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
zengjinlong/sinatra v3 224b40d4b89f 18 minutes ago 192.8 MB
ubuntu 14.10 2185fd50e2ca 2 days ago 237.2 MB
ubuntu utopic 2185fd50e2ca 2 days ago 237.2 MB
ubuntu 14.04 9cbaf023786c 2 days ago 192.8 MB
ubuntu latest 9cbaf023786c 2 days ago 192.8 MB
ubuntu trusty 9cbaf023786c 2 days ago 192.8 MB
ubuntu 14.04.1 9cbaf023786c 2 days ago 192.8 MB
ubuntu 12.04.5 a9561eb1b190 2 days ago 120.2 MB
ubuntu 12.04 a9561eb1b190 2 days ago 120.2 MB
ubuntu precise a9561eb1b190 2 days ago 120.2 MB
centos centos5 504a65221a38 2 weeks ago 467.1 MB
centos centos6 68edf809afe7 2 weeks ago 212.7 MB
centos centos7 87e5b6b3ccc1 2 weeks ago 224 MB
ubuntu 12.10 c5881f11ded9 3 months ago 172.2 MB
ubuntu quantal c5881f11ded9 3 months ago 172.2 MB
ubuntu raring 463ff6be4238 3 months ago 169.4 MB
ubuntu 13.04 463ff6be4238 3 months ago 169.4 MB
ubuntu saucy 195eb90b5349 3 months ago 184.7 MB
ubuntu 13.10 195eb90b5349 3 months ago 184.7 MB
training/webapp latest 31fa814ba25a 4 months ago 278.8 MB
ubuntu lucid 3db9c44f4520 5 months ago 183 MB
ubuntu 10.04 3db9c44f4520 5 months ago 183 MB
root@iZ28ikebrg6Z:~/docker# docker rmi centos:*
Error response from daemon: No such image: centos:*
2014/10/16 15:38:58 Error: failed to remove one or more images
root@iZ28ikebrg6Z:~/docker# docker rmi centos
Error response from daemon: No such image: centos:latest
2014/10/16 15:39:03 Error: failed to remove one or more images
root@iZ28ikebrg6Z:~/docker#
看来出了latest可以直接删除,其他的需要带上TAG才能指定删除。
好今天到这里。
阿里云部署Docker(5)----管理和发布您的镜像相关推荐
- 阿里云部署Docker(5)----管理和公布您的镜像
出到这节,我在百度搜索了一下"阿里云部署Docker",突然发现怎么会有人跟我写的一样呢?哦,原来是其它博客系统的爬虫来抓取,然后也不会写转载自什么什么的.所以,我最终明确为什么那 ...
- 阿里云部署docker项目流程
阿里云部署docker项目流程 这是自己的项目项目原来的项目是一个手机远程管理交换机的项目,项目中包含嵌入开发,python+flash对接的flutter(android+ios),mysql,re ...
- 阿里云部署Docker私有镜像仓库
一.访问阿里云容器镜像服务地址 地址:https://cr.console.aliyun.com/cn-beijing/instances 提示开通->设置密码(为Docker仓库密码) 二.选 ...
- 阿里云code结合git管理代码,运用webHook同步部署服务器代码(php)
项目场景: 阿里云code结合git管理代码,运用webHook同步部署服务器代码(php) 问题描述: git生成密钥时linux用户为root,php运行用户是www.结果导致在服务器端git p ...
- 三小时,阿里云使用docker部署redis(阅文无数)
相信大家肯定看了不少的使用阿里云通过docker部署redis的博文,但是这些博文的步骤确是模糊,最后很难成功. 第一步: 拉取redis镜像 docker pull redis # docker p ...
- 『中级篇』阿里云安装Docker企业版UCP和DTR(59)
原创文章,欢迎转载.转载请注明:转载自IT人故事会,谢谢! 原文链接地址:『中级篇』阿里云安装Docker企业版UCP和DTR(59) 前面一节讲到了如何在阿里云使用容器服务的方式,本节主要讲讲如何在 ...
- Win10环境下基于Hexo的静态博客环境搭建,及其阿里云部署
引言 1.为什么要搭建自己的个人博客 工作和学习过程中,我们经常遇到一些这样或那样的问题,此时我们可能会在网上找到相应的解决方法.但是过了一段时间之后,当我们再次碰到类似的问题时,早已忘记以前是怎么解 ...
- Docker——阿里云搭建Docker Swarm集群
阿里云搭建Docker Swarm集群 Docker Swarm概念 环境部署 Swarm集群搭建 安装Docker 配置阿里云镜像加速 搭建集群 Raft一致性算法 Swarm集群弹性创建服务(扩缩 ...
- 阿里云联合易客CRM等发布金盾宣言
本文讲的是阿里云联合易客CRM等发布金盾宣言近日,阿里云旗下软件交易与交付第一平台--云市场联合易客CRM.东软.用友.驻云.数梦等上百家知名软件服务商,共同发布金盾服务宣言,为云市场用户提供&quo ...
最新文章
- cocos中添加显示文字的三种方式(CCLabelTTF 、CCLabelBMFont 和CCLabelAtlas)
- RMAN-06026报错解决方法
- runloop - CFRunLoopObserverRef
- hadoop学习3 查找块的位置
- PackagesNotFoundError: The following packages are not available from current channels:
- 整数数组的最大子数组
- 主键和索引哪个快_字节一面,被连问 MySQL 索引,脸都问绿了。。。
- 1.2、使用pip安装Python包
- 「leetcode」406.根据身高重建队列【贪心算法】详细图解
- python面向对象(其二)
- Flexigrid For Asp.Net-MVC
- [转]软件安装管家软件安装目录
- 解决雅虎邮箱使用outlook只能收不能发送的问题(针对yahoo.com.cn)
- 移动app如何开发?
- 【计算机网络 12,Java视频下载
- jQuery_02 快速入门 $作用和方法
- TiDB沙箱环境初体验
- ZOJ 3380 Patchouli's Spell Cards(概率DP)
- 九龙证券|铁锂电池是什么?铁锂电池的工作原理和优点介绍
- 认识float的指数与尾数
热门文章
- idea2021、2022版本打不开的解决方案
- 荣耀升级android版本最好用,到底好在哪?华为荣耀升级安卓4.0体验
- 对“超图学习”相关优势及适用范围的学习及整理
- linux进入中文目录的其他方法
- 润乾配置连接kingbase(金仓)数据库
- java工作两年可以转算法吗_java转算法后平淡的一年(迷茫2019)
- 【Unity】实现视频播放
- 关于windows系统中静态库链接找不到的问题
- 【手机LR预设】黑金风格RICH移动Lightroom预设
- PHP语法糖->,::和=>