It is not always easy to have some packages installed inside the virtualenv + having the virtualenv inside the docker container, which only runs your app, makes no sense.
It would be nice to have an option i.e. --system to deploy your package right inside the system without venv.
Now solving it in a stupid way:
RUN mkdir -p /root/.cache/pypoetry/virtualenvs/phex-recutech-mcs-py3.6/lib/python3.6
RUN ln -sf /usr/local/lib/python3.6/site-packages /root/.cache/pypoetry/virtualenvs/phex-recutech-mcs-py3.6/lib/python3.6
You can disable the automatic creation of virtualenvs by using:
poetry config settings.virtualenvs.create false
having the virtualenv inside the docker container, which only runs your app, makes no sense
This is common misconception. See Deploying Python Applications with Docker - A Suggestion or Why people create virtualenv in a docker container?.
This is duplicate of issue #218
There are some situations when using a virtualenv creates complications. For example a docker container with some global python package. In my case it was compiled from the source freecad. Exposing it to the virtualenv is a headache.
For those who find here later, the config command worked for me was:
poetry config virtualenvs.create false
Most helpful comment
You can disable the automatic creation of virtualenvs by using: