Junior — Middle
What commands are typically used in the command line to define the build process of a container in a Dockerfile?
sobes.tech AI
Answer from AI
In a Dockerfile, the following instructions are usually used to define the container build process:
FROM— specifies the base image from which to start the build.RUN— executes commands during the build process (e.g., installing packages).COPYorADD— copies files from the build context into the image.CMD— sets the command to be executed when the container starts.ENTRYPOINT— sets the entry point for the container.ENV— sets environment variables.WORKDIR— sets the working directory inside the container.
Example:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]