Trying to run Docker resulted in exit code 127
Asked Answered
A

6

18

I am trying to run a certain application in windows that uses docker. Since the application is a shell script, I use the cygwin terminal. As am new to docker, I dont have a clear Idea as to how it works.

Using boot2docker, I have a docker terminal open in windows 7 and a cygwin terminal to run the script.

But when I run the script, say

   ./xyz init

I get the following error

    trying to run docker resulted in exit code 127

Can you please tell me what are the basic first aid I should go through to resolve this?

The application is obtained from vision.ai, called vmx. The information about the application is here.

https://docs.vision.ai/

Your help is much appreciated.

Andrew answered 7/1, 2015 at 13:9 Comment(1)
Check and confirm your volume is mapped correctlyAustraloid
C
29

I got almost the same issue, the problem was simply in windows ending in that file, it was using CRLF instead of LF, change it to LF and it might work (using Notepad++, IntelliJ or Visual Code), referring to these answers:

env: bash\r: No such file or directory

How do I set all files in a subdirectory to use a specific eol using gitattributes?

So my .gitattributes file now is like this:

* text=auto
/docker/* text eol=lf
/ci/* text eol=lf
/sbt text eol=lf
/docker-*.sh text eol=lf
/sbt-dist/bin/*.bash text eol=lf
/sbt-dist/bin/sbt text eol=lf

These attributes because I have play framework project deployed in docker.

Cymbre answered 9/1, 2018 at 9:42 Comment(2)
I was having this same issue and solved with this answerAbatement
+1 Finally, after a long search I got the answer.Lamentation
S
3

Make sure your file has the correct line ending.

For example, open your file using Vim and run: :set fileformat=unix, then save the file and run Docker again.

Sessile answered 2/8, 2017 at 7:39 Comment(1)
I tried to execute a shell command via php in Docker (Host is Windows, Image from Debian) and I saw only `sh: 8: --error-format: not found..." Error-Code 127. Changing "CRLF" to "LF" fixed the problem.Cordelia
I
1

I think the 127 means docker was not found on the path. Similar question. On windows docker will only work inside the boot2docker vm so if you are running the script in cygwin it would not work. You must ssh into the boot2docker vm and run your commands there.

Incredible answered 7/1, 2015 at 14:27 Comment(1)
in my case i was trying to encapsulate the entire docker run command and arguments as a string. that was incorrect and did not work; I settled on using the argument terminator ` -- ` like so: docker run ubuntu:trusty -- /usr/bin/command -a1 -b 2 argument3 argument4Armandoarmature
B
1

I would say Docker is not in your PATH. Add C:\Program Files\Docker\Docker\Resources\bin or appropriate

Beitris answered 18/7, 2017 at 21:8 Comment(1)
This was precisely my issue, I was was running on Git-bash and my EOL was already set to LF instead of CRLF.Ternary
H
1

I faced the same error while building in AWS CodeBuild. The issue was the sudo in the commands

In the buildspec.yml file, I had to change:

sudo docker build -t xxxx:xxxx

to

docker build -t xxxx:xxxx
Hypomania answered 16/5, 2020 at 6:12 Comment(0)
H
0

somtimes this also happens due to shortage of memory in my case: exho 3 > /proc/sys/vm/drop_caches

Hennahane answered 24/12, 2022 at 13:37 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Fastback

© 2022 - 2024 — McMap. All rights reserved.