Project directory support for Docker Compose?

My Dockerfile and docker-compose.yml are located in the subfolder "docker". To run docker-compose, I use this command:

docker-compose -f docker/docker-compose.yml --project-directory . up

 

In docker-compose.yml, here is how I specify the build:

djangoapp:
build:
context: .
dockerfile: ./docker/Dockerfile

 

But now, when running in PyCharm, I get the following error:

/usr/local/bin/docker-compose -f /media/pawamoy/Data/git/pawamoy/logan/docker/compose-development.yml -f /home/pawamoy/.PyCharm2018.1/system/tmp/docker-compose.override.28.yml up --exit-code-from djangoapp --abort-on-container-exit djangoapp
Building djangoapp
ERROR: Cannot locate specified Dockerfile: docker/Dockerfile

 

Indeed, it cannot locate the Dockerfile at docker/Dockerfile because by default, docker-compose sets the project directory with the directory where docker-compose.yml is, so in this case: ./docker. I want the project directory to be the current directory (.), not ./docker. The problem is that I did not find any options in the remote interpreter configuration or run configuration to specify this parameter. I can't find any "docker-compose options" menu. This parameter cannot be set with an environment variable either, unlike COMPOSE_FILE or others.

 

So, it's a feature request: I would like PyCharm to support docker-compose options, or at least the --project-directory option.

1 comment

Posted a feature request on youtrack.jetbrains.com. See the ticket here: https://youtrack.jetbrains.com/issue/PY-30749

0

Please sign in to leave a comment.