Sobes.tech
Middle

Name four key directives used in Dockerfile.

sobes.tech AI

Answer from AI

Four key directives commonly used in Dockerfile:

  1. FROM — specifies the base image from which the new image will be built.
  2. RUN — executes commands inside the container during the image build (e.g., installing packages).
  3. COPY — copies files or directories from the build context into the image's filesystem.
  4. CMD — sets the command to be executed when the container starts (can be overridden).

Example Dockerfile:

FROM node:14
RUN mkdir /app
COPY . /app
CMD ["node", "/app/index.js"]