码迷,mamicode.com
首页 > 其他好文 > 详细

docker

时间:2018-05-24 18:18:15      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:variable   tar   mos   imp   ecif   you   environ   containe   add   

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 a base 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 and COPY 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 of ADD 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 a cdcommand 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

标签:variable   tar   mos   imp   ecif   you   environ   containe   add   

原文地址:https://www.cnblogs.com/anyu686/p/9084052.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!