I am new to docker and poetry but are currently working in a project which contains both.
Problem:
I am unable to add new dependencies via poetry to the docker-compose container.
Description:
In pycharm I use docker-compose as my interpreter for a django project where poetry is used to manage the dependencies. I can access the django-project via localhost, so it seems to work.
What I tried:
The poetry documentation states the following example:
poetry add requests pendulum
But when I execute this command in the pycharm terminal it states, that python wasn't found. My expectation was that I can install a dependency via the CLI which is then managed by poetry and the poetry.lock and pyproject.toml are then updated.
Question:
How can I add new dependencies, or even access the CLI within docker compose to execute the above command?
Update:
I was able to install the dependency by:
writing in the terminal:
docker compose downdocker compose run --rm django poetry lock --no-updatedocker compose build djangoBut still unable to access a CLI where I can execute poetry commands directly.
hi this is pretty old but you should use the Dockerfile i.e RUN poetry add.. the dockerfile can be specified within compose