Skip to content

Instantly share code, notes, and snippets.

@aemloviji
Last active April 24, 2020 07:35
Show Gist options
  • Save aemloviji/05d14766154abef69abf9c0d050ed203 to your computer and use it in GitHub Desktop.
Save aemloviji/05d14766154abef69abf9c0d050ed203 to your computer and use it in GitHub Desktop.
Dockerfile Instructions

FROM — specifies the base (parent) image.
LABEL —provides metadata. Good place to include maintainer info.
ENV — sets a persistent environment variable.
RUN —runs a command and creates an image layer. Can be used to install packages into containers or run specific commands(i.e mkdir and etc.).
COPY — copies files and directories to the container.
ADD — copies files and directories to the container. Can upack local .tar files.
CMD — provides a command and arguments for an executing container. Parameters can be overridden. There can be only one CMD.
WORKDIR — sets the working directory for the instructions that follow.
ARG — defines a variable to pass to Docker at build-time.
ENTRYPOINT — provides command and arguments for an executing container. Arguments persist.
EXPOSE — exposes a port.
VOLUME — creates a directory mount point to access and store persistent data.

Note Only the instructions FROM, RUN, COPY, and ADD create layers in the final image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment