Docker instructions
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
FROM – creates a layer from the base image
eg : FROM ubuntu:18.04
MAINTAINER – The MAINTAINER instruction allows you to set the Author field of the generated images.
RUN – builds your application with make
eg : RUN make /app
CMD – specifies what command to run within the container
LABEL – The LABEL instruction adds metadata to an image.
EXPOSE – Informs Docker that the container listens on the specified network port(s) at runtime.
ENV – The ENV instruction sets the environment variable to the value .
ADD – Copies new files, directories, or remote file URLs from and adds them to the filesystem of the image at the path .
COPY – Copies new files or directories from and adds them to the filesystem of the image at the path .
ENTRYPOINT – Allows you to configure a container that will run as an executable. Command line arguments to docker run will be appended after all elements in an exec form ENTRYPOINT and will override all elements specified using CMD.
Only the last ENTRYPOINT instruction in the Dockerfile will have an effect.The shell form prevents any CMD or run command line arguments from being used, but the ENTRYPOINT will start via the shell. This means the executable will not be PID 1 nor will it receive UNIX signals. Prepend exec to get around this drawback.
VOLUME – Creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers.
USER – The USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.
WORKDIR – Sets the working directory for any RUN, CMD, ENTRYPOINT, COPY, and ADD instructions that follow it.
ARG – Defines a variable that users can pass at build-time to the builder with the docker build command using the –build-arg = flag.Multiple variables may be defined by specifying ARG multiple times
ONBUILD – Adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build. The trigger will be executed in the context of the downstream build, as if it had been inserted immediately after the FROM instruction in the downstream Dockerfile.
STOPSIGNAL – The STOPSIGNAL instruction sets the system call signal that will be sent to the container to exit. This signal can be a valid unsigned number that matches a position in the kernel’s syscall table, for instance 9, or a signal name in the format SIGNAME, for instance SIGKILL.
HEALTHCHECK – HEALTHCHECK [] CMD (check container health by running a command inside the container)
SHELL – Allows the default shell used for the shell form of commands to be overridden.