Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible run docker-compose-rule on Windows? #232

Open
kucera-jan-cz opened this issue Mar 29, 2018 · 7 comments
Open

Possible run docker-compose-rule on Windows? #232

kucera-jan-cz opened this issue Mar 29, 2018 · 7 comments

Comments

@kucera-jan-cz
Copy link

Hello,

I have tried to run https://github.com/tomasulo/docker-compose-integration-tests on Windows 7 using Docker Tools, however I was not able to run it properly. My ultimate question is, is it possible to use docker-compose-rule on Windows 7?
So far what I have discovered the problem lies with using File::getAbsolutePath in DockerComposeFiles class where JVM produces Windows path format where Docker requires unix format and fails with message of missing docker-compose file. Including stacktrace from my tests:

com.palantir.docker.compose.execution.DockerExecutionException: 'docker-compose up -d' returned exit code 1
The output was:
Windows named pipe error: The system cannot find the file specified. (code: 2)
	at com.palantir.docker.compose.execution.Command.lambda$throwingOnError$17(Command.java:60)
	at com.palantir.docker.compose.execution.Command.execute(Command.java:50)
	at com.palantir.docker.compose.execution.DefaultDockerCompose.up(DefaultDockerCompose.java:74)
	at com.palantir.docker.compose.execution.DelegatingDockerCompose.up(DelegatingDockerCompose.java:40)
	at com.palantir.docker.compose.execution.RetryingDockerCompose.lambda$up$27(RetryingDockerCompose.java:37)
	at com.palantir.docker.compose.execution.Retryer.runWithRetries(Retryer.java:44)
	at com.palantir.docker.compose.execution.RetryingDockerCompose.up(RetryingDockerCompose.java:36)
	at com.palantir.docker.compose.execution.ConflictingContainerRemovingDockerCompose.up(ConflictingContainerRemovingDockerCompose.java:51)
	at com.palantir.docker.compose.DockerComposeRule.before(DockerComposeRule.java:135)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
@rion18
Copy link

rion18 commented Apr 4, 2018

Can you check this one? #219
I had the same issue but adding those two system variables worked.

@kucera-jan-cz
Copy link
Author

@rion18 thanks for the advice, unfortunately this one does not work. It seems that the issue really lies in Windows path format and formating it to unix path representation

@rion18
Copy link

rion18 commented Apr 6, 2018

Dang. It works for me using git-bash/docker machine. Is that your own setup?

@dotCipher
Copy link
Contributor

There were a few PRs that have been opened by the previous maintainers that possibly relate to this issue:

It seems that this will be directly fixed if we get #175 merged, @hpryce do you have context on this?

@sebastientromp
Copy link

sebastientromp commented Jul 27, 2018

Hey, do you have any update on this one?
I can run docker-compose build from git bash:

$ docker-compose build

        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

But running the test using maven from the same location gives me the same error as OP (The system cannot find the file specified. (code: 2))

Edit: I set the recommended environment variables, as mentioned in #219

$ echo ${DOCKER_COMPOSE_LOCATION}
C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe

$ echo ${DOCKER_LOCATION}
C:\Program Files\Docker\Docker\resources\bin\docker.exe

@sebastientromp
Copy link

sebastientromp commented Jul 27, 2018

Edit: there was an issue with my Docker install (it crashed mid-update). I re-applied the update and don't have the symptoms described before anymore.

Keeping it in case it helps others:


I debugged a bit, and in ProcessImpl at some point the full command resolves to "C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe" --project-name 7b2ab22f --file D:\mypath\docker-compose.yml build

Running that on the command line:

$ "C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe" --project-name 7b2ab22f --file D:\mypath\docker-compose.yml build
.FileNotFoundError: [Errno 2] No such file or directory: 'D:mypathdocker-compose.yml'

I added quotes around the file name, and got:

$ "C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe" --project-name 7b2ab22f --file "D:\mypath\docker-compose.yml" build
Windows named pipe error: The system cannot find the file specified. (code: 2)

Running in debug

$ "C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe" --verbose --project-name 7b2ab22f --file "D:\mypath\docker-compose.yml" build
compose.config.config.find: Using configuration files: D:\mypath\docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['C:\\Users\\Daedin\\.docker\\config.json', 'C:\\Users\\Daedin\\.dockercfg']
docker.utils.config.find_config_file: Found file at path: C:\Users\Daedin\.docker\config.json
docker.auth.load_config: Found 'auths' section
docker.auth.parse_auth: Auth data for https://index.docker.io/v1/ is absent. Client might be using a credentials store instead.
docker.auth.parse_auth: Found entry (registry='nexus:18443', username='stromp')
[18304] Failed to execute script docker-compose
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 71, in main
  File "compose\cli\main.py", line 124, in perform_command
  File "compose\cli\command.py", line 41, in project_from_options
  File "compose\cli\command.py", line 121, in get_project
  File "compose\cli\command.py", line 95, in get_client
  File "site-packages\docker\api\daemon.py", line 181, in version
  File "site-packages\docker\utils\decorators.py", line 46, in inner
  File "site-packages\docker\api\client.py", line 198, in _get
  File "site-packages\requests\sessions.py", line 521, in get
  File "site-packages\requests\sessions.py", line 508, in request
  File "site-packages\requests\sessions.py", line 618, in send
  File "site-packages\requests\adapters.py", line 440, in send
  File "site-packages\urllib3\connectionpool.py", line 600, in urlopen
  File "site-packages\urllib3\connectionpool.py", line 356, in _make_request
  File "http\client.py", line 1239, in request
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "http\client.py", line 1026, in _send_output
  File "http\client.py", line 964, in send
  File "site-packages\docker\transport\npipeconn.py", line 31, in connect
  File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
  File "site-packages\docker\transport\npipesocket.py", line 50, in connect
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')

I don't understand that yet, but it looks like an issue with the setup, and not with the compose rule itself

@sebastientromp
Copy link

Bottom line: in this case, docker had stopped running.

See docker/compose#5801 for a more descriptive error message when docker isn't running

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants