Middle
Name four key directives used in Dockerfile.
sobes.tech AI
Answer from AI
Four key directives commonly used in Dockerfile:
- FROM — specifies the base image from which the new image will be built.
- RUN — executes commands inside the container during the image build (e.g., installing packages).
- COPY — copies files or directories from the build context into the image's filesystem.
- 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"]