January 9th, 2015

Launching H2O with Docker

RSS icon RSS Category: Uncategorized
Fallback Featured Image

Hello world, again. H2O is already relatively easy to launch, all the user needs is a compatiable Java version but now that level of difficulty is reduce to nil. Jeff, our DevOps engineer, presented me with a Docker container for H2O making shipping H2O possible regardless of your environment setup. You can now launch H2O in an isolated environment or container which is great for testing in addition to running H2O smoothly. Launching H2O with Docker has actually been done by one of our users but below is our template which of course can be modified to include R or Spark. The following has been tested and tried on Linux and MacOS. On a Mac, Docker creates a lightweight virtualization that abstracts a process into a container. On a linux, it uses LXC (Linux Containers) to share resources.
For those that never used Docker before you can read all about what Docker is, how to install, and how to launch the application here.

Launch a H2O Instance using Docker

The steps include:

  • Installation of Docker on Mac or Linux OS
  • Creating and modifying Dockerfile
  • Build Docker image from Dockerfile
  • Run Docker build
  • Launch H2O
  • Access H2O from the web browser or R

Video Tutorial



  • Linux kernal version 3.8+


  • Mac OS X 10.6+

Note: Older linux kernal versions are known to cause kernal panics and to break Docker, there are ways around it but attempt at your own risk.
You can check the version of your kernal by running uname -r in your terminal. The following walk-through has been tested on a Mac OS X 10.10.1.
Step 1 – Install and Launch Docker

Step 2 – Create or Download Dockerfile
First create a folder on the Host OS to host your Dockerfile by running:
mkdir -p /data/h2o-mirzakhani
Then either download or create a Dockerfile. The Dockerfile is essentially a build recipe that will be used to build our container.
Download and use our Dockerfile template by running:

cd /data/h2o-mirzakhani
wget https://h2o.ai/wp-content/uploads/2015/01/Dockerfile

The Dockerfile will:

  • Pull the base image which is ubuntu 14.04 and run updates.
  • Install Java 7
  • Fetch and download h2o mirzakhani from H2O’s S3 repository
  • Expose port 54321 and 54322 in preparation for launching H2O on those ports

Step 3 – Build Docker image from Dockerfile
From the /data/h2o-mirzakhani directory, run:

docker build -t="h2o.ai/mirzakhani" .

This process can take a few minutes as it assembles all the necessary parts to the image.
Step 4 – Run Docker Build
On a Mac, it is necessary to use the argument -p 54321:54321 to expressly map the port 54321. This is redundant on a linux.

docker run -it -p 54321:54321 h2o.ai/mirzakhani

Step 5 – Launch H2O
Step into the /opt directory and launch H2O. Adjust -Xmx to the memory you want to allocate to the H2O instance. By default H2O launches on port 54321.

cd /opt
java -Xmx1g -jar h2o.jar

Step 6 – Access H2O from the web browser or R

  • On a linux, when h2o finishes launching you can copy and paste the IP address and port of the H2O instance. In the following example that would be
03:58:25.963 main      INFO WATER: Cloud of size 1 formed [/ (00:00:00.000)]
  • If it is running on a Mac however you will need to find the IP address of the Docker’s network that bridges to your Host OS. To do this open a new terminal (not a bash for your container) and run boot2docker ip.
$ boot2docker ip

Once you have the IP address, point your browser to the specified ip address and port. In R you can access the instance by installing the latest version of the H2O R package and running:

dockerH2O <- h2o.init(ip = "", port = 54321)

Let us know how installation went for you or if you run into any errors or problems, in the comment section below.

Leave a Reply

What are we buying today?

Note: this is a guest blog post by Shrinidhi Narasimhan. It’s 2021 and recommendation engines are

July 5, 2021 - by Rohan Rao
The Emergence of Automated Machine Learning in Industry

This post was originally published by K-Tech, Centre of Excellence for Data Science and AI,

June 30, 2021 - by Parul Pandey
What does it take to win a Kaggle competition? Let’s hear it from the winner himself.

In this series of interviews, I present the stories of established Data Scientists and Kaggle

June 14, 2021 - by Parul Pandey
Snowflake on H2O.ai
H2O Integrates with Snowflake Snowpark/Java UDFs: How to better leverage the Snowflake Data Marketplace and deploy In-Database

One of the goals of machine learning is to find unknown predictive features, even hidden

June 9, 2021 - by Eric Gudgion
Getting the best out of H2O.ai’s academic program

“H2O.ai provides impressively scalable implementations of many of the important machine learning tools in a

May 19, 2021 - by Ana Visneski and Jo-Fai Chow
Regístrese para su prueba gratuita y podrá explorar H2O AI Hybrid Cloud

Recientemente, lanzamos nuestra prueba gratuita de 14 días de H2O AI Hybrid Cloud, lo que

May 17, 2021 - by Ana Visneski and Jo-Fai Chow

Start your 14-day free trial today