3

I'm trying to use intellij's docker integration plugin with the following tutorial on Get started with Docker Compose running on a docker-machine installed on windows 10. My project is located here: C:\Users\bob\IdeaProjects\foo.

If I run docker-compose up from the command line on my windows host, everything works. If I try to create a Docker deployment using the intellij docker integration plugin and specify the docker-compose.yml, I get the following error.

ERROR: for web  Cannot create container for service web: invalid bind mount spec "C:\\Users\\bob\\IdeaProjects\\foo:/code:rw": invalid volume specification: 'C:\Users\bob\IdeaProjects\foo:/code:rw'
Encountered errors while bringing up the project.
No containers created for service: web
Failed to deploy 'Compose:  docker-compose.yml': Some services/containers not started

I think this is only an issue with the intellij docker integration plugin. I tried creating a .env with COMPOSE_CONVERT_WINDOWS_PATHS set to either 1 or 0 with no success.

Does anyone have an idea how to fix the intellij docker integration plugin to mount volumes such as .:/code?

Francis
  • 379
  • 5
  • 21
  • Does http://stackoverflow.com/a/35316813/104891 help? – CrazyCoder Feb 19 '17 at 17:38
  • Even after reading that, it still doesn't help. Like I mentioned `docker-compose up` works when using the windows command prompt, but not from the docker integration plugin. I can't seem to figure out the difference. – Francis Feb 19 '17 at 18:23
  • FYI, I configure my windows command prompt the usual way using: `docker-machine env`, `@FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i`, `cd c:\Users\bob\IdeaProjects\foo`, `docker-compose up` – Francis Feb 19 '17 at 18:25

1 Answers1

0

Here is an extract from Docker documentation:

Compose supports declaring default environment variables in an environment file named .env placed in the folder docker-compose command is executed from (current working directory).

The tricky part here is to identify the "current working directory", which is used by Intellij IDEA. Unfortunately, Docker plugin does not allow to specify it explicitly. So, I did some research and finally found the answer in IDEA javadoc:

By default, a current directory of the IDE process is used (usually a "bin/" directory of IDE installation).

After putting the .env file under /bin of my IDEA installation and restarting the IDE, the issue was resolved for me.

Hope, it helps.

  • There's a bug in the intellij docker plugin. I provided a link mentioning that the fix will be coming in intellij version 2017.1. – Francis Mar 05 '17 at 04:24