Dockerizing Cucumber-BDD and Ruby Friends


Docker is becoming incredibly popular in the recent days. Docker containers are lightweight and can be launched as required. Well, this post is about provisioning Cucumber-Capybara BDD framework inside docker in order to execute Cucumber scenario inside the containers. This will install all the supporting tools as mentioned in the BDDfire.

Docker-BDD on DockerHub

In order to setup, Ruby-Cucumber framework inside docker, I have created a Docker image on DockerHub, called ‘docker-bdd



You can get click on image above to get to Docker-Hub and pull ‘docker-bdd‘.

Pulling Docker-BDD

Assuming you have Docker setup in your machine, you can launch docker vm. Please use docker docs in order to get you setup with docker.

Now, let’s pull the Docker image and let it provision



This  will pull Ruby docker image and start provisioning PhantomJS, RubyGems and BDDfire. You can find detailed build output on dockerhub. Build logs can be found here 


Provisioning RubyGems



Launch docker container

Assuming pull is success, we can now check that docker image is present. It should look something like this :



Now, We can launch container with following command:

Now that you should be inside the docker container and in the ‘/opt/bdd/cucumber’ directory with all the gems installed.

Now run BDDfire rake tasks inside containers using bundler.

You will see the cucumber scenario is passing with headless PhantomJS based driver Poltergeist.


You can add more scenarios and run them inside docker container.

Feel free to give it a try. Source code is on Github

Let me know if you got stuck !

Happy BDD !!

Watch Video Demo