初识Dockerfile
来源:互联网 发布:2016淘宝客pid怎么看 编辑:程序博客网 时间:2024/06/07 07:00
原文链接: 点击打开链接
Docker通过从 Dockerfile读取指令来自动编译images, Dockerfile包含生成一个image所需要的所有命令集合,它是一个文档,使用 docker build用户可以持续执行一些命令行指令.
The docker build
command builds an image from aDockerfile
and a context.
The build’s context is the files at a specified location PATH
or URL
.
--The PATH
is a directory on your local filesystem.
--The URL
is a the location of a Git repository.
Warning: Do not use your root directory, /
, as thePATH
as it causes the build to transfer the entire contents of your hard drive to the Docker daemon.
the Dockerfile
is called Dockerfile
and located in the root of the context. You use the -f
flag with docker build
to point to a Dockerfile anywhere in your file system.
$ docker build -f /path/to/a/Dockerfile .
>指定一个 image的保存路径
You can specify a repository and tag at which to save the new image if the build succeeds:
$ docker build -t shykes/myapp .
>tag多个imageTo tag the image into multiple repositories after the build, add multiple -t
parameters when you run the build
command:
$ docker build -t shykes/myapp:1.0.2 -t shykes/myapp:latest .
加速Docker编译Whenever possible, Docker will re-use the intermediate images (cache), to accelerate the docker build
process significantly. This is indicated by theUsing cache
message in the console output. (For more information, see the Build cache section) in theDockerfile
best practices guide:
Docker runs the instructions in a Dockerfile
in order.The first instruction must be `FROM` in order to specify the Base Image from which you are building.
"#" 是注释符
转义符( \ ) :
Escaping is possible by adding a \
before the variable:\$foo
or \${foo}
, for example, will translate to$foo
and ${foo}
literals respectively.
- 初识Dockerfile
- 初识DOCKERFILE
- dockerfile
- DockerFile
- Dockerfile
- dockerfile
- Dockerfile
- dockerfile
- dockerfile
- dockerfile
- DockerFile
- Dockerfile
- Dockerfile 分析
- DockerFile详解
- Dockerfile指令
- dockerfile简介
- dockerfile 使用方法
- Dockerfile编写
- simple-rtmp-server安装
- 分页、搜索、排序、全选、反选、批量删除、必选项配置、
- Hadoop平台运用朴素贝叶斯算法进行文档分类总结
- ListView的使用用ViewHolder提升效率
- android开发过程中异常和解决办法
- 初识Dockerfile
- Python中函数的使用
- S-02. 文件服务安装与配置 ❀ Windows Server 2008 R2
- js学习笔记之锚点的用法
- 感慨
- Sql Server Tempdb原理-日志机制解析实践
- 最小二乘法及其python实现
- 线程的单例模式与延迟加载中的Initialization on Demand Holder
- java 国际化