• Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • Docker Runner, Windows
    • None
    • 16
    • 2
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Problem Definition

      Bamboo does not support Docker Runner with Windows agent

      Suggested Solution

      Make Bamboo Docker Runner compatible with Windows

            [BAM-20219] Docker Runner with Windows

            Hey @uka2-matthew - I noticed the same issue. Remove the "tail -f /dev/null" from the command that Bamboo tries to run, and that command will then succesfully work in a Windows OS running docker, so it does seem like a trivial step to remove the tail -f. There may well be other parts of the process that then need adjusting to suit a Windows based image, but it would be great to hear from an Atlassian on their plan here.

            As we have a large % of our teams dev'ing in Windows, we've been looking for a non-native solution and currently testing using https://windtunnel.io/products/ksb/#/ - we've spoken with the WindTunnel team and they released version 1.3.31 last month that provides Windows support - https://marketplace.atlassian.com/apps/1222674/kubernetes-agents-for-bamboo/version-history

            While it'd be great to have better native support, the pricing for this plugin seems completely reasonable to me for what it delivers, so if that's the direction we need to go, then fine by me!

             

            I'll report back with results from our testing

             

            CCM

            Craig Castle-Mead added a comment - Hey @uka2-matthew - I noticed the same issue. Remove the "tail -f /dev/null" from the command that Bamboo tries to run, and that command will then succesfully work in a Windows OS running docker, so it does seem like a trivial step to remove the tail -f. There may well be other parts of the process that then need adjusting to suit a Windows based image, but it would be great to hear from an Atlassian on their plan here. As we have a large % of our teams dev'ing in Windows, we've been looking for a non-native solution and currently testing using https://windtunnel.io/products/ksb/#/ - we've spoken with the WindTunnel team and they released version 1.3.31 last month that provides Windows support - https://marketplace.atlassian.com/apps/1222674/kubernetes-agents-for-bamboo/version-history While it'd be great to have better native support, the pricing for this plugin seems completely reasonable to me for what it delivers, so if that's the direction we need to go, then fine by me!   I'll report back with results from our testing   CCM

            It would be great if this could be implemented soon.
            I have just got to the point where I have a remote windows agent with docker and the error I am getting is because of the `tail -f /dev/null` at the end. If this could be removed the command works (when I run it manually).

            uka2-matthew added a comment - It would be great if this could be implemented soon. I have just got to the point where I have a remote windows agent with docker and the error I am getting is because of the `tail -f /dev/null` at the end. If this could be removed the command works (when I run it manually).

            Aron Weiler added a comment - - edited

            Script tasks to the rescue!

            You CAN use docker on a Windows Agent, but it requires more manual steps.

            I have docker running my builds on Windows 10 with:

            • Bamboo Server 7.2.3
            • Docker Desktop 4.2.0
            • Using Bamboo-Specs

            There are various issues that I had to overcome, but now that everything is in place, it works very well. 

            That's not saying that Atlassian shouldn't support this feature natively (and it doesn't seem that difficult), but in case you want to implement docker containers in your build system, you can use the example YAML bamboo spec code below.

            This code includes examples for

            • Pulling your docker image
            • Running your image as a container
            • Executing commands on your container
            • Stopping the container
            • Copying files off of the container to the host system
            • Removing the container

            You may also need to log into your repo, if required, but that's just another script task executing the docker login command.

            Example Docker YAML Scripts:

             

            Example Docker Tasks:
              key: EDT
              tasks:
            
              ## Pull the docker image
              - script:
                    interpreter: BINSH_OR_CMDEXE
                    environment: DOCKER_HOST=${bamboo.docker_host}
                    scripts: 
                    - docker pull ${bamboo.docker_image_name}  
            
              ## Run the docker image as a new container with a couple of different volumes mounted
              - script:
                  interpreter: BINSH_OR_CMDEXE
                  environment: DOCKER_HOST=${bamboo.docker_host}
                  scripts:       
                  - docker run --volume ${bamboo.working.directory}:${bamboo.docker_container_build_dir} --volume c:\something_else:c:\something_else_in_container --detach --interactive --tty --net=nat --workdir=${bamboo.docker_container_build_dir} --name ${bamboo.docker_container_name} ${bamboo.docker_image_name}
              
              ## Execute a .NET build on the container
              - script:
                  interpreter: BINSH_OR_CMDEXE  
                  environment: DOCKER_HOST=${bamboo.docker_host}
                  scripts: 
                  - docker exec -i -w ${bamboo.docker_container_build_dir} ${bamboo.docker_container_name} dotnet restore ${bamboo.solution_file}
                  
              ## Stop the container because you can't use "docker cp" on a running Windows container
              - script:
                  interpreter: BINSH_OR_CMDEXE
                  environment: DOCKER_HOST=${bamboo.docker_host}
                  scripts: 
                  - docker stop ${bamboo.docker_container_name}
            
              ## Copy some files off of the container to the local file system
              - script:
                  interpreter: BINSH_OR_CMDEXE
                  environment: DOCKER_HOST=${bamboo.docker_host}
                  scripts: 
                  - docker cp ${bamboo.docker_container_name}:${bamboo.docker_container_buildoutput_dir} ${bamboo.working.directory}\buildoutput 
            
              ## Remove the stopped container (container must be stopped first)
              - script:
                  interpreter: BINSH_OR_CMDEXE
                  environment: DOCKER_HOST=${bamboo.docker_host}
                  scripts: 
                  - docker rm ${bamboo.docker_container_name}  
            
              ## Some variables
            
              ## This is necessary when using TCP for controlling the docker daemon. 
              ## If you use named pipes, setting this environment variable is not required.
              docker_host: tcp://localhost:2375
              
              docker_registry: <address:port>
              docker_registry_and_path: ${bamboo.docker_registry}/<your_path_on_registry>
              
              docker_image_name: ${bamboo.docker_registry_and_path}/<your_image_name>:latest  
              
              docker_container_name: <some_identifier>-${bamboo.buildNumber}
              docker_container_build_dir: c:\build
              docker_container_buildoutput_dir: c:\buildoutput
              solution_file: <your_solution_file>
            

             

            Aron Weiler added a comment - - edited Script tasks to the rescue! You CAN use docker on a Windows Agent, but it requires more manual steps. I have docker running my builds on Windows 10 with: Bamboo Server 7.2.3 Docker Desktop 4.2.0 Using Bamboo-Specs There are various issues that I had to overcome, but now that everything is in place, it works very well.  That's not saying that Atlassian shouldn't support this feature natively (and it doesn't seem that difficult), but in case you want to implement docker containers in your build system, you can use the example YAML bamboo spec code below. This code includes examples for Pulling your docker image Running your image as a container Executing commands on your container Stopping the container Copying files off of the container to the host system Removing the container You may also need to log into your repo, if required, but that's just another script task executing the docker login command. Example Docker YAML Scripts:   Example Docker Tasks:   key: EDT   tasks:   ## Pull the docker image   - script:         interpreter: BINSH_OR_CMDEXE         environment: DOCKER_HOST=${bamboo.docker_host}         scripts:          - docker pull ${bamboo.docker_image_name}     ## Run the docker image as a new container with a couple of different volumes mounted   - script:       interpreter: BINSH_OR_CMDEXE       environment: DOCKER_HOST=${bamboo.docker_host}       scripts:              - docker run --volume ${bamboo.working.directory}:${bamboo.docker_container_build_dir} --volume c:\something_else:c:\something_else_in_container --detach --interactive --tty --net=nat --workdir=${bamboo.docker_container_build_dir} --name ${bamboo.docker_container_name} ${bamboo.docker_image_name}   ## Execute a .NET build on the container   - script:       interpreter: BINSH_OR_CMDEXE         environment: DOCKER_HOST=${bamboo.docker_host}       scripts:        - docker exec -i -w ${bamboo.docker_container_build_dir} ${bamboo.docker_container_name} dotnet restore ${bamboo.solution_file}         ## Stop the container because you can't use "docker cp" on a running Windows container   - script:       interpreter: BINSH_OR_CMDEXE       environment: DOCKER_HOST=${bamboo.docker_host}       scripts:        - docker stop ${bamboo.docker_container_name}   ## Copy some files off of the container to the local file system   - script:       interpreter: BINSH_OR_CMDEXE       environment: DOCKER_HOST=${bamboo.docker_host}       scripts:        - docker cp ${bamboo.docker_container_name}:${bamboo.docker_container_buildoutput_dir} ${bamboo.working.directory}\buildoutput    ## Remove the stopped container (container must be stopped first)   - script:       interpreter: BINSH_OR_CMDEXE       environment: DOCKER_HOST=${bamboo.docker_host}       scripts:        - docker rm ${bamboo.docker_container_name}   ## Some variables   ## This is necessary when using TCP for controlling the docker daemon.    ## If you use named pipes, setting this environment variable is not required.   docker_host: tcp: //localhost:2375      docker_registry: <address:port>   docker_registry_and_path: ${bamboo.docker_registry}/<your_path_on_registry>      docker_image_name: ${bamboo.docker_registry_and_path}/<your_image_name>:latest        docker_container_name: <some_identifier>-${bamboo.buildNumber}   docker_container_build_dir: c:\build   docker_container_buildoutput_dir: c:\buildoutput   solution_file: <your_solution_file>  

            sclarke81 added a comment -

            This is really frustrating. As a minimum please update the documentation to make this clear. It would be great to get an update on whether you will add this functionality.

            sclarke81 added a comment - This is really frustrating. As a minimum please update the documentation to make this clear. It would be great to get an update on whether you will add this functionality.

            Joe Ward added a comment -

            Super bummed out that this error is blocking windows containers as agents. Can we implement this feature to solidify the bamboo docker runner functionality?

            Joe Ward added a comment - Super bummed out that this error is blocking windows containers as agents. Can we implement this feature to solidify the bamboo docker runner functionality?

            We're switching to containers for our CI system.  If the Docker Runner doesn't work, then we need to collapse several tasks into a single Docker task.  Please fix this.

            Jared Ahrens added a comment - We're switching to containers for our CI system.  If the Docker Runner doesn't work, then we need to collapse several tasks into a single Docker task.  Please fix this.

            We've containerized our builds for the various Linux distributions supported by our products. We'd hoped to containerize our Windows builds as well, and were some way down that path before stumbling on the "network host not found" error mentioned in BAM-20109. Kind of heartbreaking really, considering our investment in both Docker and the Atlassian toolchain.

            Chris Leonardi added a comment - We've containerized our builds for the various Linux distributions supported by our products. We'd hoped to containerize our Windows builds as well, and were some way down that path before stumbling on the "network host not found" error mentioned in  BAM-20109 . Kind of heartbreaking really, considering our investment in both Docker and the Atlassian toolchain.

            Implementing this feature would be appreciated, we have several Windows applications and want to make use of docker.

            Michael Walton added a comment - Implementing this feature would be appreciated, we have several Windows applications and want to make use of docker.

            We have also invested time into setting a Docker build plan and after quite a lot of troubleshooting found out that this is not even supported. As Adam already said this is nowhere mentioned in the documentation!

            This ticket is from 2018, can we expect this to be implemented anytime soon?

            Peter Lauko added a comment - We have also invested time into setting a Docker build plan and after quite a lot of troubleshooting found out that this is not even supported. As Adam already said this is nowhere mentioned in the documentation! This ticket is from 2018, can we expect this to be implemented anytime soon?

            Does this ticket relate to Linux Containers On Windows as well? I ask because because:

            • https://confluence.atlassian.com/bamboo/running-a-docker-container-in-bamboo-962976995.html explicitly mentions Windows (says: "run docker machine")
            • Docker capability on Windows is auto-detected in Bamboo 6.9.1
            • If I change each of the container paths listed under the volume settings to match a Linux path, I'm able to start a container. I gave up here because I'm not sure where bamboo is looking for checked-out sources (c:\users... inside the Linux container?), and I assume its not supported even if working.

            I've also spent quite a while looking at this before finding this ticket so if anyone is able to confirm either way that would be very helpful - thanks

             

            Geoff Williams added a comment - Does this ticket relate to Linux Containers On Windows as well? I ask because because: https://confluence.atlassian.com/bamboo/running-a-docker-container-in-bamboo-962976995.html explicitly mentions Windows (says: "run docker machine") Docker capability on Windows is auto-detected in Bamboo 6.9.1 If I change each of the container paths listed under the volume settings to match a Linux path, I'm able to start a container. I gave up here because I'm not sure where bamboo is looking for checked-out sources (c:\users... inside the Linux container?), and I assume its not supported even if working. I've also spent quite a while looking at this before finding this ticket so if anyone is able to confirm either way that would be very helpful - thanks  

              Unassigned Unassigned
              klfoong Foong (Inactive)
              Votes:
              92 Vote for this issue
              Watchers:
              59 Start watching this issue

                Created:
                Updated: