Possible run docker-compose-rule on Windows?
kucera-jan-cz opened this issue · 7 comments
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)
Can you check this one? #219
I had the same issue but adding those two system variables worked.
@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
Dang. It works for me using git-bash/docker machine. Is that your own setup?
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
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
Bottom line: in this case, docker had stopped running.
See docker/compose#5801 for a more descriptive error message when docker isn't running