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.
Join the DZone community and get the full member experience.Join For Free
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.
Create a new project from the top menu.
Next, you’ll need to create a new cluster by navigating to “Compute”, “Container Engine”, “Container Clusters” in the left hand menu.
I used the default values:
Click the “Create” button and you’ll see your new cluster in a list.
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.
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.
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.
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.
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.
Once installed, click the “Create Log Token” button to create your log token and generate the command to run in your terminal.
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.
If you execute “sudo docker ps” again, you can see the Logentries Container running.
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:
Easily search for the events you’re looking for:
And visualize your log data using our powerful LEQL query language.
Published at DZone with permission of Trevor Parsons, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.