Docker and Selenium Grid on Google Cloud

I will take you through the very rewarding steps to set-up Selenium Grid using Docker-Compose hosted in Google Cloud.

The Steps we will take.

  • Install an Ubuntu instance on Google Cloud
  • Open Port 4444 - This port is what our Selenium Grid will be on.
  • Install Docker Compose on our new Ubuntu Cloud Instance.
  • Install and Run a Selenium Grid via Docker Compose

  1. Install an Ubuntu instance on Google Cloud
 There are a great cloud services.  I'm choosing Google Cloud because they currently have the best free offering.  $300 (USD) and 60 days.  If you follow my steps, you won't go over 50 cents.
  1. Sign up using the free offering:  cloud.google.com
    1. Create an Ubuntu 15 instance
    1. Give your instance a name and Change Boot Disk
    1. Select Ubuntu 15
    2. Save your Change
    3. Lets open port 4444 by configuring our network
    4. Lets create a Rule
    5. Now Save the rule for port 4444


  1. Install Docker Compose - Click on SSH
  2. After the shell opens enter
    1. $ sudo su
  3. Now install Docker Compose
    1. https://docs.docker.com/engine/installation/linux/ubuntulinux/
    2. NOTE: Make sure you install for Linux 15 
  4. Now the pay off.  Lets get Selenium grid up and running.
    1. Create a directory: $ mkdir compose
    2. $ cd compose
    3. $ nano docker-compose.yml
    4. copy and paste
    5. hub: image: selenium/hub ports: - "4444:4444"chrome: image: selenium/node-chrome links: - hubfirefox: image: selenium/node-firefox links: - hub
    6. Save
    7. Run: $ docker-compose up
    8. You can see the selenium-grid at <instance ip>
      1. http://104.197.200.6:4444/grid/console
      1. Docker scales easily making this perfect Testing.
      2. Run: $ docker-compose scale chrome=7
      3. What we get is 7 additional agents!


Now - let's run a Selenium Test using our new toy.
See follow-up blog: http://cloud-docker-selenium.blogspot.com/p/selenium-grid-testng-parallel-execution.html