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. 要删除共享的初始登陆名 cmd下输入net use * /delete

    要删除共享的初始登陆名 cmd下输入net use *  /delete

  2. C#整理1——进制转换

    进制转换:二进制,八进制,十进制,十六进制. (一)二进制转十进制: 1.写2 2.标指数,从右向左,从0开始依次标记 3.乘系数,一一对应. 4.相加. 例:二进制数1101转十进制数* 1.2   ...

  3. Ext布局篇

      EXT标准布局类 收藏 面板相当于一张干净的白纸,如果直接在上面添加内容,将很难控制面板中内容的显示位置,面板元素越多就越显得凌乱,所以需要在面板上划分不同的区域,将面板内容展示到希望的位置上.E ...

  4. 利用Oracle数据库的UTL_SMTP发送HTML 邮件

    Ok, that looks hard, but if you use this procedure I wrote, its really quite easy, it does all of th ...

  5. 商品列表中显示类别名称而不是类别ID

    商品表中的字段包裹商品信息和categoryid 若要在商品列表中显示出categoryname,有两种做法: 第一种做法: 拿到categoryid后再跟数据库连接一下,然后拿出categoryna ...

  6. (转载)iscroll.js的使用

    入门 Scroll是一个类,每个需要使用滚动功能的区域均要进行初始化.每个页面上的iScroll实例数目在设备的CPU和内存能承受的范围内是没有限制的. 尽可能保持DOM结构的简洁.iScroll使用 ...

  7. js统计字符串,并且判断出现次数最多的

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. Ubuntu安装Microsoft Windows Fonts微软字体库

    ttf-mscorefonts-installer包是微软的字体包, 可以直接在软件中心中找到安装,也可以通过命令安装 sudo apt-get install ttf-mscorefonts-ins ...

  9. Dll注入的几个注意事项

    1. 使用钩子SetWindowHookEx注入时,设置钩子的代码必须和钩子回调函数在注入DLL中,并且调用CallNextHookEx时第一个参数必须为钩子的句柄,否则只有一个进程响应钩子. 2.关 ...

  10. iOS的category和protocol

    很多时候我们需要扩展一下现有的类,增加一点功能.如果有源码,修改一下即可,如果是第三方的库,就要麻烦一些.在C++中我们使用类继承的方法来实现,在ObjectiveC中当然也可以这么做,不过Objec ...