You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docker/Dockerfile_Instructions.md
+9-13Lines changed: 9 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -29,16 +29,15 @@ DockerFile
29
29
30
30
2. Docker distributes official versions of the images that can be used for building Dockerfiles under docker/dockerfile repository on Docker Hub.
31
31
32
-
33
32
-`FROM` - A valid Dockerfile must start with a FROM instruction.
34
33
35
34
-`RUN` - The RUN instruction will execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in the Dockerfile.
36
35
37
36
-`CMD` - The main purpose of a CMD is to provide defaults for an executing container.
38
37
39
-
`Note:` There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.
38
+
`Note:` There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.
40
39
41
-
`Note` - Do not confuse RUN with CMD. RUN actually runs a command and commits the result; CMD does not execute anything at build time, but specifies the intended command for the image.
40
+
`Note` - Do not confuse RUN with CMD. RUN actually runs a command and commits the result; CMD does not execute anything at build time, but specifies the intended command for the image.
42
41
43
42
-`LABEL` -The LABEL instruction adds metadata to an image. A LABEL is a key-value pair. T
44
43
@@ -51,25 +50,22 @@ DockerFile
51
50
52
51
-`ADD` - The ADD instruction copies new files, directories or remote file URLs from <src> and adds them to the filesystem of the image at the path <dest>.
53
52
54
-
If <src> is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a directory.
53
+
If <src> is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a directory.
55
54
56
55
-`COPY` - The COPY instruction copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>.
57
56
58
57
-`ENTRYPOINT` - An ENTRYPOINT allows you to configure a container that will run as an executable.
59
58
60
-
ENTRYPOINT will override all elements specified using CMD
61
-
62
-
### Understand how CMD and ENTRYPOINT interact
63
-
64
-
Both CMD and ENTRYPOINT instructions define what command gets executed when running a container. There are few rules that describe their co-operation.
59
+
1. ENTRYPOINT will override all elements specified using CMD
60
+
2. Both CMD and ENTRYPOINT instructions define what command gets executed when running a container. There are few rules that describe their co-operation.
65
61
66
-
Dockerfile should specify at least one of CMD or ENTRYPOINT commands.
62
+
3.Dockerfile should specify at least one of CMD or ENTRYPOINT commands.
67
63
68
-
-`ENTRYPOINT` - should be defined when using the container as an executable.
64
+
4. ENTRYPOINT should be defined when using the container as an executable.
69
65
70
-
CMD should be used as a way of defining default arguments for an ENTRYPOINT command or for executing an ad-hoc command in a container.
66
+
5.CMD should be used as a way of defining default arguments for an ENTRYPOINT command or for executing an ad-hoc command in a container.
71
67
72
-
CMD will be overridden when running the container with alternative arguments.
68
+
6.CMD will be overridden when running the container with alternative arguments.
73
69
74
70
-`VOLUME` - The VOLUME instruction creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers.
0 commit comments