shell格式

RUN apt-get install -y vim

CMD echo "docker so easy"

ENTRYPOINT echo "docker so easy"

Exec格式

RUN ["apt-get","install","-y","vim"]

CMD ["echo","docker so easy"]

ENTRYPOINT ["echo","docker so easy"]

通过两个dockerfile来对比


[root@localhost test]# cat dockerfile1/Dockerfile
from centos
ENV name Docker
ENTRYPOINT echo "$name so easy"
[root@localhost test]# cat dockerfile2/Dockerfile
from centos
ENV name Docker
ENTRYPOINT ["/bin/echo","$name so easy"]
[root@localhost test]# pwd
/test
[root@localhost test]# mkdir dockerfile1
[root@localhost test]# mkdir dockerfile2
[root@localhost test]# vim dockerfile1/Dockerfile
[root@localhost test]# cp dockerfile1/Dockerfile dockerfile2/
[root@localhost test]# vim dockerfile2/Dockerfile
[root@localhost test]# cat dockerfile1/Dockerfile
from centos
ENV name Docker
ENTRYPOINT echo "$name so easy"
[root@localhost test]# cat dockerfile2/Dockerfile
from centos
ENV name Docker
ENTRYPOINT ["/bin/echo","$name so easy"]
[root@localhost test]# docker build -t bigni/centos_shell ./dockerfile1/
Sending build context to Docker daemon .048kB
Step / : from centos
---> 9f38484d220f
Step / : ENV name Docker
---> Running in 556fd0d58c0f
Removing intermediate container 556fd0d58c0f
---> 43e2ff86b0c7
Step / : ENTRYPOINT echo "$name so easy"
---> Running in d50a776a6a3a
Removing intermediate container d50a776a6a3a
---> fc84f5de7f3b
Successfully built fc84f5de7f3b
Successfully tagged bigni/centos_shell:latest
[root@localhost test]# docker build -t bigni/centos_exec ./dockerfile2/
Sending build context to Docker daemon .048kB
Step / : from centos
---> 9f38484d220f
Step / : ENV name Docker
---> Using cache
---> 43e2ff86b0c7
Step / : ENTRYPOINT ["/bin/echo","$name so easy"]
---> Running in 4c226e9e7459
Removing intermediate container 4c226e9e7459
---> 350ad6186f0b
Successfully built 350ad6186f0b
Successfully tagged bigni/centos_exec:latest
[root@localhost test]# docker image ls -a
REPOSITORY TAG IMAGE ID CREATED SIZE
bigni/centos_exec latest 350ad6186f0b seconds ago 202MB
bigni/centos_shell latest fc84f5de7f3b seconds ago 202MB
<none> <none> 43e2ff86b0c7 seconds ago 202MB
bigni/centos_vim latest f853f2a3f901 hours ago 362MB
<none> <none> 3ec8199c2855 hours ago 861kB
bigni/test1 latest f5620b92331c hours ago 861kB
ubuntu 14.04 2c5e00d77a67 weeks ago 188MB
centos latest 9f38484d220f months ago 202MB
hello-world latest fce289e99eb9 months ago .84kB
[root@localhost test]# docker run bigni/centos_shell
Docker so easy
[root@localhost test]# docker run bigni/centos_exec
$name so easy
[root@localhost test]# vim dockerfile2/Dockerfile
[root@localhost test]# cat dockerfile2/Dockerfile
from centos
ENV name Docker
ENTRYPOINT ["/bin/bash","-c","/bin/echo $name so easy"]
[root@localhost test]# docker build -t bigni/centos_exec_new ./dockerfile2/
Sending build context to Docker daemon .048kB
Step / : from centos
---> 9f38484d220f
Step / : ENV name Docker
---> Using cache
---> 43e2ff86b0c7
Step / : ENTRYPOINT ["/bin/bash","-c","/bin/echo $name so easy"]
---> Running in c64527904495
Removing intermediate container c64527904495
---> 6713eb2d0b46
Successfully built 6713eb2d0b46
Successfully tagged bigni/centos_exec_new:latest
[root@localhost test]# docker run bigni/centos_exec_new
Docker so easy
[root@localhost test]#

docker--shell和Exec格式的更多相关文章

  1. Shell中取时间格式方法

    Shell中取时间格式方法2007-09-13 15:35常用date的显示格式: date +%F //2007-03-06date +%Y%m%d//20070306 date +%T //23: ...

  2. Linux下Shell日期的格式,你知道几种?

    Linux下Shell日期的格式,你知道几种? 不管是哪种语言,日期/时间都是一个非常重要的值.比如我们保存日志的时候,往往是某个前缀再加上当前时间,这样日志文件名称就可以做到唯一. 在Shell环境 ...

  3. Linux:可执行程序的Shell传参格式规范

    1. Linux下可执行程序的Shell传参格式规范 Linux下的可执行程序在运行时经常需要传一些参数,而这些参数是有规范的.包括我们自己写的在Linux系统下运行的Shell脚本.Python脚本 ...

  4. shell中exec解析(转)

    参考:<linux命令.编辑器与shell编程> <unix环境高级编程> exec和source都属于bash内部命令(builtins commands),在bash下输入 ...

  5. shell中exec解析

    参考:<linux命令.编辑器与shell编程> <unix环境高级编程> exec和source都属于bash内部命令(builtins commands),在bash下输入 ...

  6. shell编程--基本格式,基本语法,运算符,expr,(()),$[]

    02/shell编程 Shell是用户与内核进行交互操作的一种接口,目前最流行的Shell称为bash Shell Shell也是一门编程语言."."号执行脚本时,会让脚本在调用者 ...

  7. syntax error near unexpected token `do(写的shell脚本出现格式问题)--->1.问题2.展示信息3.解决方案

    1问题:Linux和windows下的回车换行符不兼容的问题 [root@node-01 script]# sh start_zk.sh art_zk.sh: line 3: syntax error ...

  8. shell的exec命令

    工作中遇到运维人员挂supervisor的时候建议启动使用命令control.sh start, 并且在control.sh 里面启动命令: exec -c ./bin/xxx -f config/x ...

  9. shell中exec命令

    1.find中的-exec参数 在当前目录下(包含子目录),查找所有txt文件并找出含有字符串"bin"的行 find ./ -name "*.txt" -ex ...

随机推荐

  1. 汇编语言之寄存器使用bx si di bp

    转载自:https://www.cnblogs.com/youxin/archive/2012/05/29/2524780.html 如果你看到这篇博客时正在做第七章问题,强烈建议先去把8.1~8.4 ...

  2. java crm 系统 进销存 springmvc SSM项目项目源码

    统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3  SSM 普 ...

  3. YARN的伪分布式安装

    前提:安装完HDFS以后 1.修改mapred-site.xml 这个文件初始时是没有的,有的是模板文件,mapred-site.xml.template 所以需要拷贝一份,并重命名为mapred-s ...

  4. TensorFlow学习——入门篇

    本文主要通过一个简单的 Demo 介绍 TensorFlow 初级 API 的使用方法,因为自己也是初学者,因此本文的目的主要是引导刚接触 TensorFlow 或者 机器学习的同学,能够从第一步开始 ...

  5. JavaScript面向对象编程(1)-- 基础

    自从有了Ajax这个概念,JavaScript作为Ajax的利器,其作用一路飙升.JavaScript最基本的使用,以及语法.浏览器对象等等东东在这里就不累赘了.把主要篇幅放在如何实现JavaScri ...

  6. 基于GPU的图像处理平台

    基于GPU的图像处理平台 1.  (309)英伟达推Jetson TX1 GPU模块力推人工智能 1.1 产品概述 Jetson TX1 GPU模块,主要针对近年来蓬勃发展的人工智能市场,包括无人机. ...

  7. Java面向对象的特征与含义

    面向对象的主要特征包括抽象.继承.封装和多态. 抽象 把一个类对象的共同特征总结出来,构造新类的过程. 继承 从已有类中得到继承信息,创建新类的过程. 封装 把数据和对数据的操作绑定起来,对数据的访问 ...

  8. tomcat启动一闪而过解决办法报错The CATALINA_HOME environment variable is not defined correctly

    解决办法: Tomcat无论在windows上还是Linux上只需要吧安装包传上去解压就行,不需要配置环境变量,吧之前有可能别人别配置的环境变量统一删掉即可(网上一大堆说需要配置的都是胡说八道).把以 ...

  9. mysql查找表名

    SELECT *FROM information_schema.TABLESWHERE 1=1 AND table_name LIKE '%order%' AND table_comment like ...

  10. vmware版本选择

    vmware哪个版本好用 2014-03-10 22:59一枚小白3 | 分类:常见软件 | 浏览6743次 准备装ghost xp,想问下哪个版本更适合?或者现在哪个版本更稳定,求不要复制,求大神解 ...