I have ran into a perplexing problem and cannot seem to find an explanation.
Run /usr/bin/sh.exe (this is sh.exe provided by Git for Windows)
Execute the following command: docker run alpine:edge /bin/sh -c "echo AAA"
Observe error (for readability I am subbing git-installation-path): docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "<git-installation-path>/usr/bin/sh": stat <git-installation-path>/usr/bin/sh: no such file or directory: unknown.
I don't understand why dockeris trying to use a LOCAL path to sh.exe (the one from Git install)
The expected result is to run an Alpine container and execute the command /bin/sh -c "echo AAA" inside the container
In the version of bash used in Git for Windows, paths using / are rewritten into Windows paths. This is because many Windows programs don't handle Unix-style paths and this makes more programs work properly.
However, in your case, this results in /bin/sh being rewritten into the path to the Windows executable, which obviously you don't want if you're passing it into a Linux Docker container. The solution to this is to double the slashes (or at least the initial slash), which will tell the shell not to rewrite it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With