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.COPYorADD— for copying files from the build context into the container.RUN— for executing commands during the build (e.g., installing dependencies).CMDorENTRYPOINT— 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"]