Containers Made Easy

Today I wanted to show you just how easy it is to get started with containers. If you aren’t familiar with the concept of containers, refer to my previous post “Living in a Containerized World“. This post is going to focus on getting started with Docker. I wanted to give you the fundamentals around getting Docker installed and how to get your first container up and running. This particular post is for those who have never worked with containers and are curious. This is all about containers made easy.

Installationcontainers

Since my workstation is running Windows, we are going to focus on Docker for Windows. However, if you use a Mac, you can install Docker for Mac as well. There are some requirements that you need to meet for your windows system. It needs to be running 64bit Windows 10 Pro, Enterprise, or Education edition with the Anniversary Update installed. If you don’t have the update installed you will be notified. In addition, you need to enable Hyper-V. You will need to reboot your system after enabling Hyper-V. If not enabled, the Docker for Windows installer will enable it for you.

You will notice that there is also something called Docker Toolbox. There is a version for Windows and Mac. If your system does not support the prerequisites, you can use the toolbox install which uses Oracle Virtual Box. Click here for the Docker Toolbox downloads.

Step 1: Now that you have met the prereqs, download Docker for Windows here. This includes Docker Engine, Docker CLI client, Docker Compose, and Docker Machine.

Step 2: Double-click InstallDocker.msi, accept the license agreement, and click Install. You may get a UAC prompt to allow this app to make changes to your device. Click Yes to continue. Click Finish to launch Docker. Once initialization is done, you will get a popup stating “Docker is now up and running”.

In addition, you will see the whale in the status bar. Right-click the whale and select About Docker to see the version. In addition you can check for updates, change the settings for startup, shared drives, how much CPU and memory to allocate, network settings, and reset to factory default. You can also access Kitematic from here. More about Kitematic later.

whale

 

 

 

 

 

 

 

Operation

Now that was too easy. Now that we have Docker installed and running, lets play. The good thing is you can open your favorite shell, be it PowerShell, or CMD.exe to run the commands. Let’s check the versions of docker, docker-compose, and docker-machine. If I type “docker version” I can see the client and server versions as well as the OS/Architecture. Likewise I can type “docker-compose version” and “docker-machine version”.

docker_version

 

 

 

 

 

 

 

 

 

If I run “docker info” I can see how many containers I have as well as the ones that are running, paused, or stopped. I can see the number of images as well as a lot more info.

docker_info

 

 

 

 

 

 

 

 

Now lets try to pull an image from Docker Hub. What is Docker Hub you ask? Docker Hub is a cloud based registry service for public or private content. It provides a centralized resource for container image discovery, distribution and change management, user and team collaboration, and workflow automation throughout the development pipeline. Now let’s type “docker run hello-world”. Congratulations, you just deployed your first container. Since the image is not local, it pulls it from Docker Hub.

hello-world

 

 

 

 

Now lets try something a bit more fun and interesting. Let’s deploy a container running nginx webserver and then validate that we can see it in our browser. Type “docker run -d -p 80:80 –name webserver nginx”. Now point your browser to http://localhost. Simple, yes? The -d is for detached mode and -p is for port.

nginx

 

 

 

 

 

Now if we type “docker ps” we can see that there is one container running. If we type “docker stop xxx”, (xxx being the first few letters of the Container ID), the container will stop running and we lose access to our site. Now if we type “docker ps” again nothing shows. That’s because there are no running containers. To see all containers type “docker ps -a”. Now you can see the container and the status shows as “Exited”. Typing “docker start xxx” and the status is now “Up”.

Now let’s clean up and stop and remove the containers that we deployed. Type “docker rm -f webserver” to stop and remove a running container. Now the container is gone but the image is still there. Type “docker images” to see all the local images. If you have no intention of using the image again go ahead and delete it. You can do so by typing “docker rmi nginx”.

Previously we mentioned Kitematic. So what is this? Kitematic is compatible with Docker for Windows and can be used as a graphical interface to manage containers. If interested, you can click here for more info.

Summary

Now that you have Docker installed and have deployed a few containers, hopefully you are beginning to see the power of containers. You surely wouldn’t be able to deploy a VM that fast. We have only scratched the surface of containers up to this point. Stay tuned as we will start to get a little more familiar with some of the other components and tooling.

 

Visualize Button for ARM Templates

In a previous post we discussed the “Deploy to Azure” button and how you could add it to your README.md file in your github repo to enable a more streamlined deployment. Click here if you are interested in reading more about that. Today I wanted to share you with a button called “Visualize”.

With “Visualize” you get a visual representation of the resources being deployed in your template and how they fit together. This could come in handy for those larger more complex deployments with many resources. Many of us relate more so to graphical representations than we do with text. I have seen some people create a Visio diagram of their deployment, capture a screen shot, and paste into the README.md file. This works perfectly fine but does create more work for you and each persons skills with Visio could vary, as well as the icons used. With the “Visualize” button we get consistency, less work for ourselves, and easier to manage when changes are made to our templates.

Let’s discuss how we can add the button. Just as we did with the “Deploy to Azure” button, you will need to copy the code below and insert into your README.md file. Copy the Raw URL for your azuredeploy.json template and paste over the URL in my example.

<a href="http://armviz.io/#/?load=https://raw.githubusercontent.com/DarylsCorner/ARM-Templates/master/vm-from-user-image/azuredeploy.json" target="_blank">
  <img src="http://armviz.io/visualizebutton.png"/>
</a>

Unlike the “Deploy to Azure” button, we do not need to be concerned with doing URL encoding for the “Visualize” button. When placing the code in the README.md file you can either place it directly after the “Deploy to Azure” button if you desire the buttons to be on the same line, as seem below.

Or you can insert a break (<br>) between the “Deploy to Azure” and the “Visualize” hyperlink tags and the buttons will be on separate lines, as seen below.

If you want to include both buttons at once you can copy the code below and replace the URLs as mentioned previously. Be sure to use URL encoding for the “Deploy to Azure” button.

<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FDarylsCorner%2FARM-Templates%2Fmaster%2Fvm-from-user-image%2Fazuredeploy.json" target="_blank">
    <img src="http://azuredeploy.net/deploybutton.png"/>
</a><a href="http://armviz.io/#/?load=https://raw.githubusercontent.com/DarylsCorner/ARM-Templates/master/vm-from-user-image/azuredeploy.json" target="_blank">
  <img src="http://armviz.io/visualizebutton.png"/>
</a>

So let’s take a look and see what the “Visualize” button displays. Upon clicking the button you will be redirected to the Azure Resource Manager Template Visualizer (ArmViz) site. As you can see below we are presented with a visual representation of our template. How cool is that? My example is very simple but you could see how this could be helpful for larger deployments.

In addition to being able to see the resources that you have declared within your ARM JSON template, you also have the capability to edit and validate directly from this representation by double-clicking on a resource. You can add resources by simply clicking on a resource from the toolbox and dragging it onto the canvas. You can open existing templates as well as edit and download the parameters file. When you are done you can download the ARM template and there is an option to actually create the “Visualizer” button for you.

Instead of me trying to explain all the capabilities here, check out this YouTube video by Jason Young, the creator of this project.

I expect this project to improve over time but so far its pretty neat. I hope this has been helpful and you find it useful.

 

 

Our Fallen Heroes

This weekend most of us are enjoying our time off of work with our families and loved ones. Some of us are enjoying a long weekend on holiday while others may be enjoying a BBQ in the park. However, let’s not forget the significance of this weekend, especially Monday, May 25th. This special day, known as Memorial Day, is a time for all of us to reflect back remembering and honoring those brave men and women who selfishly lost their lives while serving in our country’s Armed Forces. These brave men and women paid the ultimate sacrifice while allowing us to enjoy our freedom. To the families of our “Fallen Heroes”, we will never forget the sacrifices made and forever hold you in our thoughts and prayers.

During my career in the military I had the pleasure to serve with a fallen hero who I will never forget. I first met John at a previous unit where we served together as the crew on a Coast Guard C-130 airplane. John was a flight engineer who was extremely knowledgeable on the aircraft systems as well as one of the top mechanics that I’ve known. He was looked upon and highly regarded for his expertise. I was a navigator on the C-130 and John and I spent many hours doing various missions and deployments together. I can honestly say I might not be here today if it weren’t for the quick actions of John to save us from a junior pilot’s mistake during a routine training mission. I will never forget just how kind he was and he had a laugh that I will always remember. CG1705

I eventually transferred to a new unit, USCG Air Station Sacramento, California located on McClellan AFB, where I spent a few more years before leaving the military in 2001 for a new opportunity. Sometime after John was transferred to Sacramento where he held the rank of Chief Petty Officer. On the eve of October 29th, 2009, USCG aircraft 1705 departed on  a Search and Rescue (SAR) mission to search for a missing person off the coast of San Diego, CA. John was the flight engineer on this mission along with six other crewmembers. Around 7pm, about 50 miles off the coast at an altitude of about 1000 feet, the C-130 was involved in a midair collision with a Marine AH-1W Super Cobra helicopter with a crew of two. The helicopter was actively engaged in a training exercise near San Clemente Island. According to the Aviation Safety Network, no single factor or individual act or omission caused this mishap.

I recall the moment I heard the news of the midair collision and was shocked as I had been there in that same situation many times before and logged many hours in that same aircraft. However, once I found out that I knew one of the crewmembers I was floored. John was a fellow aircrew member, a military brother, but most importantly he was my friend. He will be missed, he is missed, and his life was lost while protecting others. Rest in peace my friend, Chief Petty Officer John Seidman. You are forever in our thoughts.

So please take time this weekend to reflect back on those who lost their lives while protecting ours.

There is a great program called “Folds of Honor” that provides scholarships and educational opportunities to the children and spouses of those killed or disabled while in service to our nation. If you know of someone who may benefit from this program please share this with them.

“A hero is someone who has given his or her life to something bigger than oneself.” — Joseph Campbell

An American Soldier

Today is a special day. For some its a day off of work, for others a day off of school. For many of us, its a day of celebration VeteransDayand thanks for those who served. It’s Veteran’s Day! Veteran’s Day celebrates the service of all U.S. military veterans. In memory of those who served, and in honor of those who serve us now. This includes Army, Navy, Air Force, Coast Guard, and the Marines.

Most people do not understand the sacrifices that are made by a soldier. It’s those selfless moments, those sleepless nights, and the time away from loved ones that defines a soldier. He is a father to their children and a husband to their mother. He has sworn to protect and defend his country, but he doesn’t do it for the money. He does it for pride and responsibility. He doesn’t have the luxury to take a sick day like most. He spends his holidays defending our flag no matter what the cost. He is an American Soldier.

For many of you, like myself, you can probably relate to this. We have sacrificed a lot, by choice I may add, to ensure freedom for our fellow Americans. I’m not saying that every war was necessary, but in every war a sacrifice was made. I spent some of the best days of my life serving along side my military brothers and sisters and I wouldn’t trade it for anything. It was tough at times being away from your family and loved ones. But receiving letters from home always made you feel better.

It is so important, whether you agree with the cause or not, to not forgot those veterans who have sacrificed so much to ensure peace for the rest of us. If you do one good thing today, thank a veteran for his service.

To those who I served with and to those who didn’t come home, God Bless and thank you for your service.

Veterans Day: Discounts and Freebies 

soldier