Getting Started with Docker, Google Container Engine and Logentries

DZone 's Guide to

Getting Started with Docker, Google Container Engine and Logentries

A simple step by step on how to get going with some of the most talked about cloud technologies.

· Cloud Zone ·
Free Resource

There’s been a lot of industry buzz around Docker recently, with particular focus on its ability to streamline how companies manage their platforms.

With all this talk, you might be wondering how easy it is to set up Docker and evaluate it for yourself.

While it isn’t too difficult to install Docker directly on a server or virtual machine, Google has recently made it even easier with their cloud platform’s “Container Engine”, now out of beta.

Google’s Container Engines have Docker pre-installed, enabling you to simply choose the Docker images of your choice and you’re up and running. Google’s Container Engine is free if you’re using less than 5 virtual machines.

When we tested Google’s Container Engine, it took us less than 10 minutes to sign up, start a new container engine and see the log data appearing in Logentries. And if you missed our announcement, we recently announced our DockerFree plan, offering free logging from Docker containers, so there’s no reason not to set up Docker with Logentries!

How to Get Up and Running

First, sign up for a free trial of Google Cloud Platform if you don’t already have an account (though it’s free, you’ll still need to provide billing details to use the Compute API).

Once you’re signed up, make sure the Google Cloud Compute API is enabled. You’ll see this menu option in the top right of the page.

Screen Shot 2015-08-31 at 1.54.38 PM

Create a new project from the top menu.

Screen Shot 2015-08-31 at 1.54.55 PM

Next, you’ll need to create a new cluster by navigating to “Compute”, “Container Engine”, “Container Clusters” in the left hand menu.

Screen Shot 2015-08-31 at 1.55.11 PM

I used the default values:

Screen Shot 2015-08-31 at 1.55.38 PM

Click the “Create” button and you’ll see your new cluster in a list.

Screen Shot 2015-08-31 at 1.55.54 PM

This may take a few minutes – when you see the green tick appear, click on the cluster name to go to the summary screen. Scroll down to the “nodes” row and click the link beside it.

Screen Shot 2015-08-31 at 1.56.02 PM

Next, click the SSH button – this will open a new browser window that will allow you to interact with your new virtual machine.

Type in “sudo docker ps”, hit return and you will see that Docker is pre-installed, with some containers running already.

Screen Shot 2015-08-31 at 1.56.16 PM

In the meantime, I signed up for a new Logentries account so I can see my Docker logs. Sign up at logentries.com/dockerfree and you’ll be automatically prompted to create a new log.

Select “Docker” from the bottom right of the page.

Screen Shot 2015-08-31 at 1.56.28 PM

Enter the name of the Log Set that you want to create. A Log Set is a logical grouping of related logs for easy access and navigation.

Screen Shot 2015-08-31 at 1.56.57 PM

Follow the instructions below to install the Logentries container that will send Docker logs to your Logentries account. You will type these commands in the SSH window you opened earlier.

Screen Shot 2015-08-31 at 1.57.11 PM

Once installed, click the “Create Log Token” button to create your log token and generate the command to run in your terminal.

Screen Shot 2015-08-31 at 1.57.34 PM

Run this in the SSH window, which will start the Logentries Docker Container and automatically start sending your Docker log data into the log you have just created.

Hint: use the “-d” flag to run the container in detached mode, so you can continue to use the terminal window after starting the container. If you get permissions errors, use the “–privileged” flag as well.

Screen Shot 2015-08-31 at 1.57.43 PM

If you execute “sudo docker ps” again, you can see the Logentries Container running.

Screen Shot 2015-08-31 at 1.57.50 PM

That’s it! You now have a virtualized Docker engine running in the cloud and pushing its log data into Logentries – and all with just a few clicks of your mouse.

Now you can view your Docker logs in real time:

Screen Shot 2015-08-31 at 1.58.01 PM

Easily search for the events you’re looking for:

Screen Shot 2015-08-31 at 1.58.11 PM

And visualize your log data using our powerful LEQL query language.

Image title

docker, google container engine, logentries

Published at DZone with permission of Trevor Parsons , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}