What is Dockerfile: Dockerfile similar script that we've learned, we've learned will achieve out of the mirror above docker, using an automated way. Dockerfile role:
1, find a mirror: ubuntu
2, create a container: docker run ubuntu
3, into the container: docker exec -it container command
4, operation: Configuration applications ....
5, construct a new image: docker commit
Dockerfile use guidelines:
1 large: the first letter must be uppercase D
2, empty: as far as possible Dockerfile in an empty directory.
3, single-: each container has only one possible function.
4, less: command execution, the better.
Dockerfile divided into four parts:
Mirroring the basis of information come from?
Maintainer information Who am I?
Mirroring operation instructions how to do it?
Hey instruction execution when the container starts! ! !
Dockerfile contents of the file:
The first line annotations
Command (uppercase) parameters
Dockerfile use the command:
[Python]
plain text view Copy the code
1
2
3
4
5
6
7
|
#构建镜像命令格式:
docker build
-
t [镜像名]:[版本号][Dockerfile所在目录]
#构建样例:
docker build
-
t nginx:v0.
2
/
opt
/
dockerfile
/
nginx
/
#参数详解:
-
t 指定构建后的镜像信息,
/
opt
/
dockerfile
/
nginx
/
则代表Dockerfile存放位置,如果是当前目录,则用 .(点)表示
|
More technical information may concern: gzitcast