Sobes.tech
Junior — Middle

What instructions must be present in a Dockerfile for correct container building?

sobes.tech AI

Answer from AI

The following instructions must be present in a Dockerfile for correct container assembly:

  • FROM — specifies the base image from which your container will be built.
  • COPY or ADD — for copying files from the build context into the container.
  • RUN — for executing commands during the build (e.g., installing dependencies).
  • CMD or ENTRYPOINT — define the command that will run when the container starts.

Example of a minimal Dockerfile:

FROM ubuntu:20.04
COPY app.sh /app.sh
RUN chmod +x /app.sh
CMD ["/app.sh"]
What instructions must be present in a Dockerfile for… - sobes.tech