Continuous Integration back to Bas(h)ics, part 2

The previous blog entry showed you how you can run bash in a reproducible way. But what if you want your bash script to spawn docker containers? Well then you will need to use another image.

A very simple recipe is illustrated below.

Write the bash script


    #!/bin/bash

    docker run -i manorrock/bash:4.3.42 /bin/bash -c 'echo boo'
        

Execute the script using the bash docker image

    
    docker run -v $PWD:/mnt -v /var/run/docker.sock:/var/run/docker.sock -i 
      manorrock/bash:4.3.42-docker-1.12.6  /bin/bash myscript.sh
        

And voila! The bash script spawns another docker container.

Posted April 10, 2017

Up