Monday, December 10, 2018

My own Docker image

My own Docker image

Here is the format of the Dockerfile:
# Comment
INSTRUCTION arguments
The instruction is not case-sensitive. However, convention is for them to be UPPERCASE to distinguish them from arguments more easily.
Docker runs instructions in a Dockerfile in order. A Dockerfile must start with a `FROM` instruction. The FROM instruction specifies the Base Image from which you are building. 

Parser directives (e.g. "# directive=value") are optional, and affect the way in which subsequent lines in a Dockerfile are handled. 
Parser directives are written as a special type of comment in the form "# directive=value"
A single directive may only be used once.
Examples:
1.
FROM microsoft/nanoserver
COPY testfile.txt c:\\
RUN dir c:\

2.
FROM busybox
ENV foo /bar
WORKDIR ${foo}   # WORKDIR /bar
ADD . $foo       # ADD . /bar
COPY \$foo /quux # COPY $foo /quux
Environment variables are supported by the following list of instructions in the Dockerfile:
  • ADD
  • COPY
  • ENV
  • EXPOSE
  • FROM
  • LABEL
  • STOPSIGNAL
  • USER
  • VOLUME
  • WORKDIR

See more:

No comments: