Docker Dockerfile basic configuration

1, dockerfile Introduction

Dockerfile Docker is used to build text files mirrored containing instructions and custom formats. The mirror may be constructed by the docker build Dockerfile command. This layout configuration process is similar to the traditional distributed cluster, and provides a series of uniform resource configuration syntax. Users can be carried out with the unified command syntax on demand configuration, distributed on different platforms through this unified configuration file, you can build according to automate the configuration file to use when needed, which addresses the development / building operation and maintenance personnel complex process image. Meanwhile, Dockerfile used in conjunction with a mirror so that when building Docker can take advantage of cache mirroring function, greatly enhance the efficiency of use of Docker.

With a little popular words of: dockerfile is according to their need to customize a mirror, just like you write shell scripts, like the series of procedures or steps, all written dockerfile file, step by step implementation of the contents of the file you write dockerfile .

2, dockerfile instruction

 

 

3, build command

Usage:docker build [OPTIONS] PATH | URL | -

The OPTIONS:
-t, - after the tag list # building image name
-f, --file string # Dockerfiile specified file location

示例:
1,docker build . 
2,docker build -t nginx:v10 .
3,docker build -t nginx:v10 -f /path/Dockerfile /path

Commonly used to build a second way, we will switch to the directory Dockerfile build file to build, so no need to specify the -f parameter. If not quite understand it, let's build a mirror nginx, php mirror to understand it.

Details Reference:

https://blog.51cto.com/ganbing/2074640

https://yeasy.gitbooks.io/docker_practice/image/build.html

 

Guess you like

Origin www.cnblogs.com/shen-qiang/p/11876843.html