Learning Docker on Google Cloud Platform : CoreOS is your Friend

In an earlier blog post, I had presented the view that one of the best ways to learn Docker in my opinion is to move to the cloud and not do this stuff on your local machine. Chief reasons among them being bandwidth issues that could completely spoil your experience around Docker.

I usually recommend Google Cloud Platform to almost anyone that I meet due to its simplicity and behind the scenes power that is provided to you via Google’s amazing infrastructure. However, this is not the post for that.

So, assuming that you want to get started with Google Cloud Platform as a vehicle to learn Docker, I suggest that you do the following:

Sign up for Google Cloud Platform

There is a free trial period of 2 months with a credit for $300 and this should be sufficient for your needs to learn Docker. I am not a marketing vehicle for anyone but you will love the platform and the power that it gives you.

Create Compute Engine instance

Compute Engine is the Infrastructure as a Service (IaaS) component in Google Cloud Platform. While it is a vast topic, our goal here is to simply get ourselves a Virtual Machine (Compute Engine instance).

To do that, go to the Compute Engine –> VM Instances option in Developer Console for your project. Click on Create Instance.

This should lead you to a form where you can define your resource (VM) capabilities in terms of Processor, RAM , which Operating System, which Region it should be hosted in and so on.

Just focus on the following attributes while filling up the form for Create a new instance:

  • Name : Give a name to your instance. For e.g. yourname-01
  • Firewall : Enable HTTP traffic. You might need it if you plan on setting up some web servers using Docker which rely on the default port 80. If you wish to keep this unchecked, remember to come back to Firewall settings to eventually open up your server to the world.
  • Zone : Leave it as is, unless you are particular about where your instance should reside. Remember that each region has its own pricing. When you grow to more serious projects around Google Cloud Platform, this is an important thing to keep in mind.
  • Machine type : I suggest you leave it with the default one. But do look around in the list if you want extra computing power. Remember cost is a factor. If you want to downgrade the processing power a bit, that is fine too.
  • Image : This is very important. While you can go with several Linux based distributions and then install Docker on them – I suggest do not go there. Go for the image type CoreOS (coreos-stable-*). This is a Linux OS that is containerized from the grounds up and has Docker installed for you, so that you are good to go the moment you fire up the instance and SSH into it. This OS opened my eyes to some solid architecture and you should definitely take a look at it. Especially for a predominantly Windows person that I have been for a majority of my career, you will love what you see. It should give you enough A Ha! moments as you go along. And by the way, the music group A Ha! is a favourite of mine.Let me give you a hint: Applications on CoreOS run as Docker containers. 
  • Leave all the other options at their defaults. And click on Create.

This should create the Compute Engine instance for you. For e.g. if you named your instance as yourname-01, you should see the instance listed when you go to the Compute Engine –> VM Instances page.

You will see a button titled “SSH” next to each Compute Engine instance that you create. This will directly enable you to SSH into the running VM instance via the browser itself. This is a very useful feature to avoid any other tools to be setup on your machine.

Once you successfully SSH into the instance, you should see the familiar Linux Screen. A sample screenshot is given below:

Screen Shot 2015-03-27 at 6.14.54 pm

Begin your Docker journey NOW!

Try out a few commands as given below:

Screen Shot 2015-03-27 at 6.17.45 pm

Obviously we do not have any images right now and if we run docker images, there will be none listed but that is just the start.

If you are itching to get started, check out the Getting Started Guides at:

Additional Notes on Google Cloud Platform

Google Cloud Platform provides 3 ways to interact with it, as a client. They are:

  1. Web Console (which I described above) and which you access via the web browser.
  3. Google Cloud SDK , which provides a set of command line utilities that you can install on your machine (It supports Windows, Mac and Linux) and execute commands from your terminal/command prompt.

So everything that I mentioned via the Web console can be done by (2) and (3) – but since the focus was on learning Docker and using Cloud resources, I did not want to create any local setup for you.

Google Cloud Platform also provides Container optimized Linux Images for your to use while creating the instance. If you are familiar with the Google Cloud SDK from the command line / terminal and want to use the gcloud tool to create instances, do read up on Container VMs.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s