I use PyCharm for my python development and normally I use a virtual env but now I found poetry and it manages the dependencies in a better way than just having a pip requirements file.
I had issues loading correctly a poetry environment from docker compose into pycharm available environments.
This sometimes works, sometimes I just reload the entire environment.
Run your docker image of course.
Go to the Python Project Settings at: Project Interpreter
Click over Python Interpreter and select Show All...
Click over the +
button and add a new docker compose item.
Continue through the wizard and select your Docker service correctly.
The wizard will try to run docker? I dont know why it fails over my pycharm or what but it does not seem to matter.
Shell into your docker container and execute: poetry env info -p
and copy that path and include /bin/python
On the wizard click over the 3 dots: ...
Add the path from the poetry environment but remember to add /bin/python
at the end.
And hopefully... you will have your environment correctly.
Happy coding.
There is an actual YouTrack issue to follow if you are interesting in something from jetbrains: https://youtrack.jetbrains.com/issue/PY-42909/Support-poetry-in-docker-compose-python-interpreter
This is easier to do if you move Step 7 (copying environment info) to between Steps 1 and 2, since once you are into the process of adding the interpreter, you can't switch to a different PyCharm pane (i.e. Services) to perform step 7 (could use a different terminal application though).