Job in Docker problem
Asked by Andrzej Wisi?ski:

Hi I'm new to Bamboo world and I'm having a problem while trying to run Job in Docker Container.

'C:\\Program Files\\Docker\\Docker\\resources\\bin\\docker.exe run --volume C:\\Users\\Andrzej\\bamboo-agent-home\\xml-data\\build-dir\\SAL-SAL-JOB1:C:\\Users\\Andrzej\\bamboo-agent-home\\xml-data\\build-dir\\SAL-SAL-JOB1 --volume C:\\Users\\Andrzej\\bamboo-agent-home\\temp:C:\\Users\\Andrzej\\bamboo-agent-home\\temp --detach --name 5a38d756-eafa-4d18-bbda-c908f80ea3a1917506 5e72db905f20 tail -f /dev/null\\n ... in: C:\\Users\\Andrzej\\bamboo-agent-home\\xml-data\\build-dir\\SAL-SAL-JOB1\\nSTDERR: docker: Error response from daemon: invalid mode: \\Users\\Andrzej\\bamboo-agent-home\\xml-data\\build-dir\\SAL-SAL-JOB1.STDERR: See 'docker run --help'.

I see that error is related to volumes that are mounted by default so I tried to remove them, but then my build fails with such issue:

```
Failing task since return code of [C:\Users\Andrzej\AppData\Local\Temp\runInDocker3907411279854472529.sh /usr/bin/bash test.sh] was -1 while expected 
```

test.sh is just a simple script that does one echo command so I really don't know why it returns -1. Could someone help?


Answers:
author: Jim Knepley - ReleaseTEAM
body: I'm curious about the --volume parameters. I would normally expect something more like

```
--volume demo_volume:/data
```

...as opposed to having the volume and mount point be the same Windows path.

comments: author: Andrzej Wisi?ski
body: To be honest I don't need volumes for now. But when I removed them from job setup I'm getting another error saying that my script returned -1.

```
command 15-Jul-2024 23:16:41 Beginning to execute external process for build 'Salesforce - Salesforce-CICD - Default Job #76 (SAL-SAL-JOB1-76)'\n ... running command line: \nC:\Users\Andrzej\AppData\Local\Temp\runInDocker7219650513349138895.sh /usr/bin/bash test.sh\n ... in: C:\Users\Andrzej\AppData\Local\Temp\nsimple 15-Jul-2024 23:16:41 Failing task since return code of [C:\Users\Andrzej\AppData\Local\Temp\runInDocker7219650513349138895.sh /usr/bin/bash test.sh] was -1 while expected 0
```

Script is just only one echo command. Doesn't matter if its inline or file script.


author: Jim Knepley - ReleaseTEAM
body: I interpret a -1 return code to be something dramatic, like not having enough RAM or something (not saying that's the problem, just maybe something fundamental).

The ellipsis in your output makes me think the output was truncated. Try *docker logs* for that container and hopefully it will show you the full error.


author: Andrzej Wisi?ski
body: Maybe I'm wrong and I'll need volumes, because for some reason this runInDocker.sh script that is being copied to container tries to cd to my Windows path.

# cat runInDocker984723768067173822.sh  
#!/bin/sh  
cd 'C:\\Users\\Andrzej\\Downloads\\bamboo\\bamboo\\xml-data\\build-dir\\SAL-SA-JOB1'  
umask 000  
'C:\\Users\\Andrzej\\Downloads\\bamboo\\bamboo\\temp\\SAL-SA-JOB1-26-ScriptBuildTask-8958078326951920057.bat'  
exit $?

Do you know how I can handle this? For now I want my agent to create container, clone repository inside newly created container and run one script there.


Tags: docker