Sobes.tech
Junior — Middle

Can you give examples of commands used in a Dockerfile to build a container?

sobes.tech AI

Answer from AI

The following commands are often used in a Dockerfile:

  • FROM — sets the base image for building the container.
  • RUN — executes commands during the build process, such as installing dependencies.
  • COPY — copies files from the build context into the image.
  • WORKDIR — sets the working directory inside the container.
  • CMD — specifies the command to run when the container starts.

Example:

FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]
Can you give examples of commands used in a… - sobes.tech