DevOps ~ Dockerfile - rohit120582sharma/Documentation GitHub Wiki

A Dockerfile is a text file that contains the necessary commands to assemble an image. Once a Dockerfile is created, the administrator uses the docker build command to create an image based on the commands within the file.

The Dockerfile syntax looks like this:

# Comment
INSTRUCTION arguments

A Dockerfile uses the following commands for building the images:

  • COPY: Copy files from a source on the host to the container’s own filesystem at the set destination.
  • CMD: Execute a specific command within the container.
  • ENTRYPOINT: Set a default application to be used every time a container is created with the image.
  • ENV: Set environment variables.
  • EXPOSE: Expose a specific port to enable networking between the container and the outside world.
  • FROM: Define the base image used to start the build process.
  • MAINTAINER: Define the full name and email address of the image creator.
  • RUN: Central executing directive for Dockerfiles.
  • USER: Set the UID (the username) that will run the container.
  • VOLUME: Enable access from the container to a directory on the host machine.
  • WORKDIR: Set the path where the command, defined with CMD, is to be executed.
⚠️ **GitHub.com Fallback** ⚠️