Monday, December 7, 2015

Container Apps on Azure


If you are a fan of Containers (Docker especially) like me, Azure is making sure that it has the same love as you and me.

 

Apart from initiatives like CoreOS (which I believe is the best that could've happened to Azure from the containerization stand-point), Container apps are one more way to start with a Dockerized app pre-installed with a VM the moment you start with it.

Awesome!

 

Lets see how to make and use a container app, but before we do that I need you to learn about Azure Resource Manager Templates, do take some time out if you really want to understand the story of how it works ? Here are a few links to start you with Azure Resource Manager or ARM Templates as they popularly call it


 

Even if you don't know about ARM, don't get intimidated with the concept and a big repo, its just a template format by which you can deploy multiple resources (VM's, databases e.t.c) in one go, that's it, with a lots of bells and whistles when you actually get to know the entire concept.

 

I would start with creating a Containerized VM which has got a MongoDB running in Docker inside it

 

  1. Go to Portal.azure.com and click on 'New', and select 'Container App', Select 'MongoDB'




 
  1. In the next window, click on 'Create' - which will prompt you for settings to create a new virtual Machine, Selecting the VM size, Settings related to storage account and Network and Finally a review Summary









Click create in Review summary, and a VM will start deploying.


  1. This VM as you see can be accessed by a public port using ssh, what's great about this VM is it comes with a pre-installed Docker , and a Dockerized running MongoDB Image.




               4. Lets now SSH into this VM (using the public IP Address) and see if we have a running mongo docker image in it




  1. Voila! We have a running mongo that you can connect with, but since you have the mongo running inside docker and you don't have a client on your azure machine, you won't be able to do a command like mongo unless you install the mongodb client using the command

# apt-get install mongodb-clients

You can't possibly ssh into this docker image because the only open port is 27107 so install your client and go ahead connect with it like

# mongo localhost -p 27017



Awesome! Now you have a Dockerized Mongo running inside your VM.

What if you want to boot up with a rather complex container system which contains more than one container images, like you want nginx and mongo both installed in one go, the templates that you see in container apps are actually one platform in a container getting deployed at the server, if you want a rather complex one you need to create your own customized deployment; That we'll cover in our next blog post. 

No comments:

There was an error in this gadget