Dockerfile

Description:

FROM

  • Base image, from docker hub
  • A valid Dockerfile must start with a FROM instruction.
  • The image can be any valid image.
    • FROM python:3.7

COPY

  • Copy individual file from source code to image or COPY . .

WORKDIR

  • Equivalent to cd
  • The WORKDIR instruction sets the working directory for any RUNCMDENTRYPOINTCOPY and ADDinstructions that follow it in the Dockerfile.
  • If the WORKDIR doesn’t exist, it will be created even if it’s not used in any subsequent Dockerfile instruction.
    • WORKDIR /app

RUN

  • Run in shell

ENV

  • Environment variable

CMD

  • Last command
  • Use it for starting the app