Junior — Middle
Have you had experience creating and managing Docker images?
sobes.tech AI
Answer from AI
Yes, I have experience working with Docker images in Python projects. I have created Dockerfiles to package applications with necessary dependencies, ensuring a consistent runtime environment across different machines.
The main steps I used:
- Choosing a base image, such as
python:3.9-slim. - Copying source code and dependency files (e.g.,
requirements.txt). - Installing dependencies via
pip install. - Defining the command to run the application.
A simple example of a Dockerfile for a Python application:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "app.py"]
I also managed images using commands like docker build, docker run, docker push for registry uploads and automated image builds in CI/CD pipelines.