1、docker image 镜像

容器的基石
层叠的只读文件系统
联合加载(union mount)
 
2、镜像存储地址
/var/lib/docker
3、镜像操作
列出镜像
镜像标签和仓库
查看镜像
删除镜像
1)列出镜像
$docker images [OPTSIONS] [REPOSITORY]
-a, --all=false 显示所有镜像
-f, --filter=[] 显示时的过滤条件
--no-trunc = false 不使用截断的模式显示数据
-q, --quiet = false 只现实veid
[root@text3 ~]# docker images

REPOSITORY          TAG              IMAGE ID           CREATED           VIRTUAL SIZE

centos         latest              eeb3a076a0be        10 hours ago         196.7 MB

ubuntu               latest              ab035c88d533        2 weeks ago          187.9 MB

2)镜像仓库和标签
镜像
REPOSITORY 仓库(包含一个一个独立的镜像)
REGISTRY 仓库
标签
TAG
ubuntu:14:04
ubuntu:latest(如果镜像没有标签名,默认使用latest)
3)查看镜像
$docker inspect [OPTIONS] CONTAINER | IMAGE [CONTAINER | IMAGE…]
-f, --format = “”
[root@text3 ~]# docker inspect centos
 
4)删除镜像
$docker rmi [OPTIONS] IMAGE [IMAGE…]
-f,  --format = false Force removal of the image
—no-prune = false Donot delete untagged parents
[root@text3 ~]# docker rmi $(docker images -q ubuntu) 删除所有ubuntu镜像
 
 
获取和推送镜像
查找镜像
拉取镜像
推送镜像
 
1)查找镜像
方法一:Docker Hub
https://registry.hub.docker.com
方法二:$docker search [OPTIONS] TERM
--automated = false Only show automated builds
--no-trunc = false Don’t truncate output
--s, —stars = 0 Only displays with at least x stars
最多返回25个结果
2)拉取镜像
方法一:$docker pull [OPTIONS] NAME [:TAG]
-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"
https://www.daocloud.io
3)推送镜像
$docker push NAME [:TAG]
docker push dormancypress/nginx
 
构建镜像
$docker commit 通过容器构建镜像
$docker build 通过Dockerfile文件构建
1)使用commit构建镜像
$docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
-a, —author = “” Author
e.g.,”John Hannibal Smith hannibal@a-team.com”
-m, —message = “” Commit message
-p, —pause = true Pause container during commit
例:

[root@text3 ~]# docker commit -a 'Tale' -m 'nginx' commit_test dormancypress/commit_test1 构造镜像

84daaea3c4fa276f777af22efaeadc65490124dc356c5219d5e7cf57554ad49a

[root@text3 ~]# docker run -d -p 80 --name nginx_web1 dormancypress/commit_test1 nginx -g "daemon off;” 用构造的镜像生成容器

e887d27c3cd3ea342de3b21e4c233a14bfdb80675644e15de87967651c05c4e6

2)使用Dockerfile构建镜像
1、创建Dockerfile
例:
  #First dockerfile for test
  FROM ubuntu
  MAINTAINER dormancypress "k.guogao@outlook.com"
  RUN apt-get update
  RUN apt-get -y install nginx
  EXPOSE 80
2、使用$docker build命令
$ docker build -t="dormanctpress/df_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. Docker镜像与仓库(一)

    Docker镜像与仓库(一) Docker镜像与仓库(一) 如何查找镜像? Docker Hub https://registry.hub.docker.com docker search [OPTI ...

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

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

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

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

  6. docker镜像的仓库

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

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

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

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

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

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

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

随机推荐

  1. __init__ __new__区别

    请运行代码: class A: def __init__(self): print "A.__init" def __new__(self): print "A.__ne ...

  2. MVVM模式应用 之xml文件的读取

    XML如下所示: <?xml version="1.0" encoding="utf-8" ?> <schools> <schoo ...

  3. 那些年优秀的HTML5活动页面

    一个好的手机活动宣传 更能让人分享 传播是爆炸性的 下面是我平时看到一些好的微信活动宣传页面  分享给大家 其中用到的技术 常做微信活动 专题页面的人 可以看看大神们是怎么做的  这样到自己做的时候 ...

  4. OOS升级服务

    给我们的应用程序做个版本更新服务,展示一个安装程序如何实现自动更新. //服务组,添加需要的任何服务 public enum ServerEnum { AutoupdateService,//自动升级 ...

  5. C#编写自动关机程序复习的知识

    首先一个程序第一要素是logo 在设置里面可以设置程序图标,在ICON里设置. ICON图标可以在网上下载. 这些都是表面功夫 程序中涉及到Buton.Label.Timer.Notiflcon控件 ...

  6. SQL语句の循环添加数据

    declare @i intset @i=1while @i<=1000begininsert into News_ITM(title,msg,subDateTime,author,imageP ...

  7. React/React Native 的ES5 ES6写法对照表-b

    很多React/React Native的初学者都被ES6的问题迷惑:各路大神都建议我们直接学习ES6的语法(class Foo extends React.Component),然而网上搜到的很多教 ...

  8. JavaScript中url 传递参数(特殊字符)解决方法

    有些符号在URL中是不能直接传递的,如果要在URL中传递这些特殊符号,那么就要使用他们的编码了.下表中列出了一些URL特殊符号及编码 十六进制值1. + URL 中+号表示空格 %2B2. 空格 UR ...

  9. LeetCode_3 sum closet

    Given an array S of n integers, find three integers in S such that the sum is closest to a given num ...

  10. Buddy system伙伴分配器实现

    wikipedia:http://en.wikipedia.org/wiki/Buddy_memory_allocation The buddy memory allocation technique ...