Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo detached docker not available for next task

Francisco Cuesta
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 26, 2024

I am a trying to run my Matlab docker image in Bamboo to perform certain simulations, but I got stuck after Matlab docker task is completed since this docker image seems to be unavailable for following tasks in my Bamboo plan.

Currently I have configured the Docker run task as follows
enter image description here

I see that it loads the MAtlab docker image and it is able to run it, but afterwards it closes it so it is not available for the next task in my plan which tries to issue the following command

'matlab myFolder -batch mainCI'

I have also tested with below command and same results as log below

'matlab${bamboo.buildNumber} -sd myFolder'

My task after running Matlab docker looks like this
enter image description here

and this is the log I can share

26-Mar-2024 08:58:35 Starting task 'Matlab Docker run' of type 'com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli'
26-Mar-2024 08:58:35 Running image name (myLocalUrl/matlab:r2023aWithReport)
26-Mar-2024 08:58:35
Beginning to execute external process for build ' testing - Main test #107 '
... running command line:
/usr/bin/docker run --volume /home/bamboo/bamboo-agent-home/xml-data/build-dir/myDir:/myFolder --workdir /myFolder --detach --name matlab107 myLocalUrl/matlab:r2023aWithReport
... in: /home/bamboo/bamboo-agent-home/xml-data/build-dir/myDir
26-Mar-2024 08:58:35 45dee212b16c467003ef482985bfe07d8b67d80b6fef00cdc1222d123e9c24cc
26-Mar-2024 08:58:36 Finished task 'Matlab Docker run' with result: Success
26-Mar-2024 08:58:36 Starting task 'Script' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'
26-Mar-2024 08:58:36
Beginning to execute external process for build ' testing - Main test #107 (myDir-107)'
... running command line:
/home/bamboo/bamboo-agent-home/temp/myDir-107-ScriptBuildTask-356509690805256537.sh -batch mainCI
... in: /home/bamboo/bamboo-agent-home/xml-data/build-dir/myDir/myFolder
26-Mar-2024 08:58:36 /home/bamboo/bamboo-agent-home/temp/myDir-107-ScriptBuildTask-356509690805256537.sh: 1: matlab -sd myFolder -batch mainCI: not found
26-Mar-2024 08:58:36 Failing task since return code of [/home/bamboo/bamboo-agent-home/temp/myDir-107-ScriptBuildTask-356509690805256537.sh -batch mainCI] was 127 while expected 0

I have been reading this Bamboo ticket and this How to avoid Docker container deletion after build completion but I haven't managed to make it work...

Any suggestion of what else can I do to make the Matlab docker available for next task?

Thanks in advance!

 

1 answer

2 votes
Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2024

Hello Francisco Cuesta,

Welcome to Atlassian community

When you select Detach container option in the Docker Task, the container will run in the background, see my example below

1. Docker Task

image.png
2. Now in my Script task I am inspecting this running container with name shanky and I can see the results which means the container is running within the script task and will be killed when the Job finishes.

image.png

Build Logs

image.png

You can see above the container shanky is in running status when the script task is getting executed.

I think the way you are describing the commands in not correct, I am not familiar with your container structure so can't opine.

Regards,

Shashank Kumar

**please don't forget to Accept the answer if your query was answered**

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events