D
D
dasdasdsadas2022-03-27 16:51:07
Python
dasdasdsadas, 2022-03-27 16:51:07

Why is venv not saved in a Docker container?

I'm trying to create a virtual environment container based on Python 3.10.4 on Alpine Linux:

Dockerfile
FROM python:alpine3.14

VOLUME /home/project
WORKDIR /home/project

RUN python -m venv env

If you go into the container and look at the files, then there is no virtual environment.
I tried to create and activate instead of an empty creation:
RUN python -m venv env && source env/bin/activate
It still gives an error that the virtual environment has not been created.
What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2022-03-27
@dasdasdsadas

FROM python:alpine3.14

WORKDIR /home/project

RUN python -m venv /home/project/env

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question