Docker镜像与仓库(一)

Docker镜像与仓库(一)

如何查找镜像?

1.--automated=false #Only show automated builds
2.--no-trunc=false #Don't truncate output
3.-s,--stars=0 #Only displays with at least x stars

最多返回25个结果

举个栗子,

1.[KANO@kelvin ~]$ docker search centos
2.INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
3.docker.io docker.io/centos The official build of CentOS. 1775 [OK]
4.docker.io docker.io/jdeathe/centos-ssh CentOS-6 6.7 x86_64 / EPEL/IUS Repos / Ope... 14 [OK]
5.docker.io docker.io/jdeathe/centos-ssh-apache-php CentOS-6 6.7 x86_64 / Apache / PHP / PHP m... 11 [OK]
6.docker.io docker.io/million12/centos-supervisor Base CentOS-7 with supervisord launcher, h... 9 [OK]
7.docker.io docker.io/blalor/centos Bare-bones base CentOS 6.5 image 8 [OK]
8.docker.io docker.io/nimmis/java-centos This is docker images of CentOS 7 with dif... 7 [OK]
9.docker.io docker.io/torusware/speedus-centos Always updated official CentOS docker imag... 7 [OK]
10.docker.io docker.io/jdeathe/centos-ssh-mysql CentOS-6 6.7 x86_64 / MySQL. 4 [OK]
11.docker.io docker.io/consol/centos-xfce-vnc Centos container with "headless" VNC sessi... 3 [OK]
12.docker.io docker.io/nathonfowlie/centos-jre Latest CentOS image with the JRE pre-insta... 3 [OK]
13.docker.io docker.io/consol/sakuli-centos-xfce Sakuli end-2-end testing and monitoring co... 2 [OK]
14.docker.io docker.io/nickistre/centos-lamp LAMP on centos setup 2 [OK]
15.docker.io docker.io/layerworx/centos CentOS container with etcd, etcdctl, confd... 1 [OK]
16.docker.io docker.io/lighthopper/orientdb-centos A Dockerfile for creating an OrientDB imag... 1 [OK]
17.docker.io docker.io/nathonfowlie/centos-jira JIRA running on the latest version of CentOS 1 [OK]
18.docker.io docker.io/nickistre/centos-lamp-wordpress LAMP on CentOS setups with wp-cli installed 1 [OK]
19.docker.io docker.io/softvisio/centos Centos 1 [OK]
20.docker.io docker.io/yajo/centos-epel CentOS with EPEL and fully updated 1 [OK]
21.docker.io docker.io/blacklabelops/centos Blacklabelops Centos 7.1.503 base image wi... 0 [OK]
22.docker.io docker.io/januswel/centos yum update-ed CentOS image 0 [OK]
23.docker.io docker.io/jsmigel/centos-epel Docker base image of CentOS w/ EPEL installed 0 [OK]
24.docker.io docker.io/labengine/centos Centos image base 0 [OK]
25.docker.io docker.io/lighthopper/openjdk-centos A Dockerfile for creating an OpenJDK image... 0 [OK]
26.docker.io docker.io/pdericson/centos Docker image for CentOS 0 [OK]
27.docker.io docker.io/timhughes/centos Centos with systemd installed and running 0 [OK]
28.[KANO@kelvin ~]$ docker search -s 3 centos
29.INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
30.docker.io docker.io/centos The official build of CentOS. 1775 [OK]
31.docker.io docker.io/jdeathe/centos-ssh CentOS-6 6.7 x86_64 / EPEL/IUS Repos / Ope... 14 [OK]
32.docker.io docker.io/jdeathe/centos-ssh-apache-php CentOS-6 6.7 x86_64 / Apache / PHP / PHP m... 11 [OK]
33.docker.io docker.io/million12/centos-supervisor Base CentOS-7 with supervisord launcher, h... 9 [OK]
34.docker.io docker.io/blalor/centos Bare-bones base CentOS 6.5 image 8 [OK]
35.docker.io docker.io/nimmis/java-centos This is docker images of CentOS 7 with dif... 7 [OK]
36.docker.io docker.io/torusware/speedus-centos Always updated official CentOS docker imag... 7 [OK]
37.docker.io docker.io/jdeathe/centos-ssh-mysql CentOS-6 6.7 x86_64 / MySQL. 4 [OK]
38.docker.io docker.io/consol/centos-xfce-vnc Centos container with "headless" VNC sessi... 3 [OK]
39.docker.io docker.io/nathonfowlie/centos-jre Latest CentOS image with the JRE pre-insta... 3 [OK]

如何拉取镜像?

1.docker pull [OPTIONS] NAME[:TAG]
2.参数:
3. -a,--all-tags=false #Download all tagged images in the repository

实际在国内拉取镜像文件是很慢的,要想加速这一过程,可以使用国内的镜像站:

使用--registry-mirror选项:

  1. 修改:/etc/default/docker
  2. 添加:DOCKER_OPTS="--registry-mirror=http://MIRROR-ADDR"

    MIRROR-ADDR可以使用譬如daocloud.io注册账户然后生产一个地址,修改到/etc/default/docker中。

如何将自己的镜像上传到docker hub上?

1.docker push NAME[:TAG]

如何构建镜像?


为何要构建镜像?

  • 保存对容器的修改,并再次使用
  • 自定义镜像的能力
  • 以软件的形式打包并分发服务及其运行环境

docker提供了两种方式:

  1. 通过容器构建
1.docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
2.参数:
3. -a,--author="" #Author e.g.,"John Hannibal Smith hannibal@a-team.com"
4. -m,--message="" #Commit message
5. -p,--pause=true #Pause container during commit
  1. 通过Dockerfile文件构建
1.docker build

创建一个存放Dockerfile的目录

1.[KANO@kelvin ~]$ sudo mkdir -p dockerfile/test
2.[KANO@kelvin ~]$ cd dockerfile/test
3.[KANO@kelvin ~]$ sudo vi Dockerfile

创建第一个Dockerfile填入下面内容

1.#First Dockerfile
2.FROM centos:7
3.MAINTAINER kano "125439083@qq.com"
4.RUN yum update
5.RUN yum install -y nginx
6.EXPOSE 80

保存退出,然后就可以使用

1.docker build [OPTIONS] PATH | URL | -
2. --force-rm=false
3. --no-cache=false
4. --pull=false
5. -q,--quiet=false
6. --rm=true
7. -t,--tag=""

来构建

譬如进入文件目录中,运行

1.docker build -t="test" .

于是就完成了构建

Docker镜像与仓库(一)的更多相关文章

  1. 第四章 使用Docker镜像和仓库(二)

    第四章 使用Docker镜像和仓库(二) 回顾: 开始学习之前,我先pull下来ubuntu和fedora镜像 [#9#cloudsoar@cloudsoar-virtual-machine ~]$s ...

  2. 第四章 使用Docker镜像和仓库

    第4章 使用Docker镜像和仓库 回顾: 回顾如何使用 docker run 创建最基本的容器 $sudo docker run -i -t --name another_container_mum ...

  3. 04_Docker入门(下)之docker镜像和仓库的使用

    docker镜像和仓库 镜像介绍 docker镜像是由文件系统叠加而成的.最低端是一个引导文件系统,即bootfs.当一个容器启动后,它会将被移动到内存中,而引导文件系统则会被卸载,以留出更多的内存以 ...

  4. Docker之- 使用Docker 镜像和仓库

    目录 使用Docker 镜像和仓库 什么是 Docker 镜像 列出 Docker 镜像 tag 标签 Docker Hub 拉取镜像 查找镜像 构建镜像 创建Docker Hub 账号 使用 Doc ...

  5. docker镜像的仓库

    一.docker镜像的仓库 --- repos-registry的创建: 仓库分为公共仓库和私有仓库 DockerHub的官方仓库 https://hub.docker.com DockerPool社 ...

  6. Docker镜像的仓库及底层依赖的核心技术(3)

    一.docker镜像的仓库 仓库分为公共仓库和私有仓库 DockerHub的官方仓库:https://hub.docker.com DockerPool社区仓库:https://dl.dockerpo ...

  7. 《第一本docker书》第4章 使用docker镜像和仓库 读书笔记

    docker最底端是一个引导文件系统,即bootfs. 第二层是root文件系统rootfs,位于引导文件系统之上. 在传统的Linux引导过程中,root文件系统会最先以只读的方式加载,当引导结束并 ...

  8. docker镜像与仓库

    1.docker image 镜像 容器的基石 层叠的只读文件系统 联合加载(union mount)   2.镜像存储地址 /var/lib/docker 3.镜像操作 列出镜像 镜像标签和仓库 查 ...

  9. Docker镜像与仓库(二)Dockerfile

    Docker镜像文件与仓库(二) Docker镜像文件与仓库(二) Dockerfile指令 Dockerfile格式: 1.#Comment注释2.INSTRUCTION大写的指令名 argumen ...

随机推荐

  1. [DevExpress]图表开发工具类 ChartUtils

    /// <summary> /// 基于.NET 3.5的Chart工具类;对应的DevExpress版本:12.1.7; /// </summary> public stat ...

  2. Android 开发中的View事件监听机制

    在开发过程中,我们常常根据实际的需要绘制自己的应用组件,那么定制自己的监听事件,及相应的处理方法是必要的.我们都知道Android中,事件的监听是基于回调机制的,比如常用的OnClick事件,你了解它 ...

  3. Ajax实现动态的二级级联菜单

    今天花了点时间用Ajax实现了一个二级级联菜单.整理总结一下.为了把重点放在Ajax和级联菜单的实现上,本文省略了数据库建表语句和操作数据库的代码! 数据库建表语句就不帖出来了.主要有两张表,区域表: ...

  4. static 和 extern

    外部函数:定义的函数能被本文件和其他文件访问,默认所有的情况都是外部函数,不允许有同名的外部函数 >>extern定义和声明一个外部函数(可以省略) 内部函数:定义的函数只能被本文件访问, ...

  5. Visual Studio快速封装字段方法

    在面向对象的编程中我们常常要将各个字段封装为属性,但是当字段多的时候往往这个重复的操作会大大降低我们的开发效率,那么如何才能快速的封装字段呢?下面就给大家2个解决方法: 1.使用封装字段方法: 选中字 ...

  6. HTML代码中<%%>、<%=%>、<%:%>各是什么意思?分别用来实现什么的?

    运行.获取后台代码或值.<%%>之间可以写服务器端代码,比如 <% for(var i=0;i<10;i++){ //执行循环体 } %> 又如 <% for(va ...

  7. 其实你不懂wget的心-01

    wget用英语定义就是the non-interactive network downloader,翻译过来就是非交互的网络下载器. 1 wget都支持什么协议的下载? wget支持HTTP.HTTP ...

  8. 基于jQuery的前端如何做到无伤迁移

    首先,解释一下我个人对前端无伤迁移的理解,即移动端和PC端使用同一套代码,或者说原本在PC端运行得很完美的代码,只要修改少许,就可以在移动端完美运行. 当然,大部分的公司会专门为移动端设计了一套,同时 ...

  9. Android TextView 手动上下滑动

    有时候项目需求,TextView只显示若干行,其他部分隐藏,需要滑动才会显示,一般默认都是自动填充全部显示,或者手动设置高度,那样文字就显示不全,这时候可以使用下面的解决方案,代码设置显示的行数,然后 ...

  10. HTML5 canvas绘制线条曲线

    HTML5 canvas入门 线条例子 1.简单线条 2.三角形 3.填充三角形背景颜色 4.线条颜色以及线条大小 5.二次贝塞尔曲线 6.三次贝塞尔曲线 <!doctype html> ...