docker
Posted anyu686
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker相关的知识,希望对你有一定的参考价值。
in DockerFile
ockerfile contains instructions
on how the image should be built. Here are some of the most common instructions that you can meet in a Dockerfile:
FROM
is used to specify abase image
for this build. It‘s similar to the builder configuration which we defined in a Packer template, but in this case instead of describing characteristics of a VM, we simply specify a name of a container image used for build. This should be the first instruction in the Dockerfile.ADD
andCOPY
are used to copy a file/directory to the container. See the difference between the two.ADD
allows<src>
to be an URL- If the
<src>
parameter ofADD
is an archive in a recognised compression format, it will be unpacked
RUN
is used to run a command inside the image. Mostly used for installing packages.ENV
sets an environment variable available within the container.WORKDIR
changes the working directory of the container to a specified path. It basically works like acd
command on Linux.CMD
sets a default command, which will be executed when a container starts. This should be a command to start your application.
以上是关于docker的主要内容,如果未能解决你的问题,请参考以下文章