Search code examples
pythondockerpycharmdockerfilegcloud

Uneable to link Pycharm docker container with already existing container


I've created a Docker Image in order to be able to run a Docker Container with some services like gcloud datastore. If I run my application using my local packages I can connect to that container without any problem and access to the service.

However, if a try to use docker as an interpreter in Pycharm I cannot access to the service. The application works fine but Pycharm creates a new container that I'm not able to link with the one I created before. Is there any way of avoiding Pycharm creating a new container and using mine instead? If not, is there a way of modifying the container that Pycharm creates in order to be able to link it?

The whole point is to achieve to have a complete development environment included in a container and be able to run it without further installation.


Solution

  • Finally I found how to do it with Pycharm:

    Instead of using the Docker Image as an interpreter a new Python configuration should be created.

    enter image description here

    New arguments can be added in Docker container settings so that Pycharm uses them when creating the container that runs the application. This way --link option can be specified and the user can work with several containers at the same time.