Join our Discord Server
Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).

Setting up Docker Hosts on Google Compute Engine using Docker Machine

1 min read

Docker Machine enables a simplified approach to set up Docker hosts on supported platforms, including Linux, Windows, OS X, and various cloud providers, in a standard way. As per Docker Inc.  “It automatically creates hosts, installs Docker on them, then configures the docker client to talk to them. A “machine” is the combination of a Docker host and a configured client.”

Docker Inc., in their official documentations speaks about Docker Machine compatibility with the following providers:

1. AWS
2.  Digital Ocean
3. Google Compute Engine
4. IBM Softlayer
5. Microsoft Azure && Hyper-V
6. OpenStack
7. VirtualBox
8. Rackspace
9. Ubuntu server over SSH – generic driver
10. VMware Fusion/vCloud Air/vSphere

You can play around with different releases and features of Docker Machine at https://github.com/docker/machine/releases

I had Windows 8.1 machine where I wanted to setup Docker Machine to work with my Google Cloud instances. Rather than logging into Google Cloud console and then trying to install manually, I preferred getting stuffs handled automatically through Docker Machine. Just few commands and I am ready to create Docker Host instances on the fly. Here is how I got Docker Machine working with Google Compute Engines.

Setting up Google Cloud SDK Platform

1. Download Google Cloud SDK from https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe
2. As pre-requisite, you will need Python 2.7 to install it. Select All Users to get this installed automatically.

GCE_1

GCE_2

GCE_3

As shown above, python 2.7 is required to be installed.

GCE_4

Let the installation take care of python 2.7 installation.

GCE_5

GCE_6

Great !! The Google Cloud SDK is successfully installed.

Next, its time to authenticate your local Windows machine to the remote Google Cloud Compute Engine.

GCE_7

As stated, GCE_8

Ensure that the right project ID is entered while providing the following command: gcloud config set project PROJECT_ID.

Setting up New Container Host through Docker Machine:

Finally one can use Docker Machine to setup a new docker container Host through the following command:

Docker_Google_working

Docker6_instance

You can easily see the Google Cloud Engine instances as shown below:

gCloud_instances

That’s all. You can easily setup multiple Docker hosts on Google Cloud Engine sitting on your local Windows machine through Docker Machine.

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).
Join our Discord Server