初识Dockerfile
2016-05-24 17:06
746 查看
原文链接: 点击打开链接
Docker通过从 Dockerfile读取指令来自动编译images, Dockerfile包含生成一个image所需要的所有命令集合,它是一个文档,使用 docker build用户可以持续执行一些命令行指令.
The
a context.
The
build’s context is the files at a specified location
--The
a directory on your local filesystem.
--The
a the location of a Git repository.
Warning:
Do not use your root directory,
as the
it causes the build to transfer the entire contents of your hard drive to the Docker daemon.
the
located in the root of the context. You use the
with
a Dockerfile anywhere in your file system.
Image在编译好后的保存操作
>指定一个
image的保存路径
You can specify a repository and tag at which to save the new image if the build succeeds:
>tag多个image
To tag the image into multiple repositories after the build, add multiple
when you run the
加速Docker编译
Whenever
possible, Docker will re-use the intermediate images (cache), to accelerate the
cache section) in the
practices guide:
Docker
runs the instructions in a
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
the variable:
for example, will translate to
respectively.
Docker通过从 Dockerfile读取指令来自动编译images, Dockerfile包含生成一个image所需要的所有命令集合,它是一个文档,使用 docker build用户可以持续执行一些命令行指令.
The
docker buildcommand builds an image from a
Dockerfileand
a context.
The
build’s context is the files at a specified location
PATHor
URL.
--The
PATHis
a directory on your local filesystem.
--The
URLis
a the location of a Git repository.
Warning:
Do not use your root directory,
/,
as the
PATHas
it causes the build to transfer the entire contents of your hard drive to the Docker daemon.
the
Dockerfileis called
Dockerfileand
located in the root of the context. You use the
-fflag
with
docker buildto point to
a Dockerfile anywhere in your file system.
$ docker build -f /path/to/a/Dockerfile .
Image在编译好后的保存操作
>指定一个
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多个image
To tag the image into multiple repositories after the build, add multiple
-tparameters
when you run the
buildcommand:
$ 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 buildprocess significantly. This is indicated by the
Using cachemessage in the console output. (For more information, see the Build
cache section) in the
Dockerfilebest
practices guide:
Docker
runs the instructions in a
Dockerfilein
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:
\$fooor
\${foo},
for example, will translate to
$fooand
${foo}literals
respectively.
相关文章推荐
- docker安装ubuntu14.04 免登录dockerfile版
- 制作自己的镜像(一)
- 制作自己的镜像(二)
- Docker 2 -- 关于Dockerfile
- 初始docker(三)
- 制作各种docker镜像
- GIS+=地理信息+容器技术(6)——Dockerfile介绍
- 阿里云部署Docker(9)----Dockerfile脚本定制你的镜像
- 阿里云部署Docker(9)----Dockerfile脚本定制镜像
- Docker 简介
- dockerfile简介
- DockerFile详解
- Docker 之Dockerfile 快速学习
- CentOS 6.5 Docker自制CentOS镜像
- Docker:创建支持ssh服务的镜像!!!
- Dockerfile创建Linux/CentOS6.x Nginx MySQL Tomcat PHP(LNMTP)镜像 推荐
- docker学习笔记3—使用Dockerfile与docker build命令创建一个nginx服务器镜像,并使用浏览器进行访问
- 用dockerfile配置生成docker image并实现容器部署(redis服务)
- 6.Dockerfile
- 用dockerfile配置生成docker image并实现容器部署 推荐