Dockerfile Explained
Rule no 1 - The name of the file should be "Dockerfile" only.
Dockerfile is used to build images. It's is a text file that contains all the commands a user could call on the command line to create an image.
Here the commands you can use in a Dockerfile are explained with examples wherever possible. Hope it helps.
The general format of a command is "INSTRUCTIONS arguments".
Ex : RUN echo "Hello Docker !!"
Dockerfile is used to build images. It's is a text file that contains all the commands a user could call on the command line to create an image.
Here the commands you can use in a Dockerfile are explained with examples wherever possible. Hope it helps.
The general format of a command is "INSTRUCTIONS arguments".
Ex : RUN echo "Hello Docker !!"
FROM
FROM <image>
The
FROM
instruction sets the Base Image for subsequent instructions. As such, a valid Dockerfile
must have FROM
as its first instruction. The image can be any valid image – it is especially easy to start by pulling an image from the Public Repositories.
Ex : FROM ubuntu
MAINTAINER
MAINTAINER <name>
This allows you to set the Author field of the generated images.
RUN
Executes a command and save the result as a new layer.
EX: RUN echo "Hi"
EXPOSE
EXPOSE <port> [<port>...]
The
EXPOSE
instruction informs Docker that the container listens on the specified network ports at runtime.
Ex: EXPOSE 22
ADD
ADD <src>... <dest>
Copies a file from the host system onto the container
Comments
Post a Comment