07 - Going cloud - Docker hosting

we'll discuss Docker hosting options. While more integrated storage options for Docker containers do exist, there are still unmet niche use scenarios for instance hosting. And there's no shortage of startups trying to fill the gaps. It's worth while bearing in mind that everything about Docker is still quite new and very much in flux. So it's to be expected that many of the startup services that are beginning to appear are still a bit rough. Some will quickly fail, some aren't quite finished and others face periods of change and growing pains.
  Docker hosting: full access and repo hosting 
With that in mind, we'll discuss two different classes of Docker hosting: full access hosting and repo hosting.
 
We discuss Amazon's Elastic Beanstalk service in a separate video in this series. Tutum is a good example of a full service Docker hosting service. It should be noticed that Tutum is still considered beta and they advise you not to use their service for your production containers not just yet at any rate.
 
Let's launch a new container just to show how it works. We have a choice we can either use a jumpstart-preconfigured template, which is designed to fill very common needs. So for instance they have a list of possible database servers that you might need, or cache servers, or SSH servers, etc. You could also chose to pull a public image and incorporate that into your project or a private image.
 
We're going to stick with a jumpstart and we're going to select the CouchDB image. We'll call it "CouchDBAcademy" or "CloudAcademy." We'll leave the image tag as "Latest." We'll use only a single container rather than a cluster for load balancing and we'll leave the run command the way it is.
 
There also advanced options allowing a customized entry point as an example, or customized ports or custom domains. We'll take what we get, and we'll go with the defaults, and we'll move onto environmental variables where we can select an API role or provide full access. We'll stick with full access for now. We could link to other containers to create a data flow in or out as needed. We could add environment variables. Then again, we'll stick with the defaults just to show how really easy this is.
 
Click on "Launch Container." And it'll be a couple of minutes before our new CouchDB Docker container is actually up and running. But I lied it wasn't a couple of minutes: it was just a few seconds.
 
Endpoints, the tab item Endpoints shows us which web addresses to use to access our container. Logs will give us a review of events that have occurred in the very short lifetime of our container but particularly importantly it shows us how to access CouchDB using curl, that is providing command line access for the database. While it's true that Docker provides its own repository hosting on its own website, other services offer alternate features sets.
  How to set up a repository on Quay 
Quay for instance provides repository hosting and management that's aimed specifically at organizations requiring secure and private storage. The fact is Quay has a very nice integrated tutorial of their own on their site. You might try to use it yourself but we'll quickly run through the key steps needed to set up a repository on Quay just to illustrate.
 
First, you have to login from your command line on your computer "using sudo docker login" and then quay.io. I'm already logged in here. Next, we'll create a container "sudo docker run busybox," which is a good illustration because Busybox is pretty much the smallest distribution of an operating system you'll ever find.
 
"Echo" just to have it do something and we'll stream the output to a file let's say called "Output." Enter my local password and it probably worked. We'll find out right away. "sudo docker ps -l" returns the existence of a container called Busybox colon latest and its container ID is 15300, etc.
 
Let's commit "sudo docker commit." We'll paste the container ID of our container and then we'll direct that to Q-U-A-Y, Quay.io/DBClinton" because that's the name of my account on Quay and we'll call it "Quay First." That seems to have worked.
 
We now have an image. Let's push the image to "docker push" but it's going to push again to Quay.io, /DBClinton/QuayFirst." Now that we pushed our image up to Quay let's go to the Quay's website and click on "Repositories." Our repositories are listed first so click on the one we just created, then we can edit and view the settings and configuration. We can add descriptions by right clicking on the tag.
 
We can delete a tag and of course at the top right just as in Docker's website we are given the address to use to pull the repository onto your computer at home if you should need it there or to anybody else in your team wherever they happen to be.
  dotCloud Docker hosting 
We should also take a quick look at dotCloud the web hosting service that's most closely associated with Docker because it's actually run by the same people who created Docker. Docker actually was a spin-off from dotCloud. The first thing you have to do is go to the dotcloud.com website and create an account.
 
Once you've done that, head to your terminal. You might have to install Python Setup Tools. This way I don't because they're already installed on my machine but once you've done that successfully, then use the Python setup tools and specifically easy install to install Pip, and using Pip dotCloud. Let's enter our password. And we're done.
 
Let's now run dotCloud Setup. To configure dotCloud to associate itself with our account that we had already created on dotCloud's website enter your username and the password you used on the dotCloud website and we're in. Now let's create our first app. We will begin by making a directory let's say called "NewApp." Let's change directory to NewApp and we'll create an index file, an index html file using "Nano." The contents of the file could really be anything but it's just something we'll use to test to make sure from a browser that eventually this app is actually running. It will contain nothing but a little bit of markup and the words, "Hello from CloudAcademy.com." "Ctrl-x," "Y" for "Yes" and we've saved it.
 
Now we have some content and we have a directory but obviously there's no application yet so dotCloud, which will tell our system that we're now going to work within the dotCloud environment. "Create NewApp." Now I did use the website console to begin creation of an application called NewApp but decided that it made more sense to demonstrate the process of creating an app on the console. So since however, the process of beginning this new app had begun on the console it can't be recreated here so let's do it again with a new name. Let's call it "NewerApp."
 
We'll connect the directory to NewerApp, which presumably now exists online. Let's create a build file using Nano. We must name it "dotcloud-dot-Y-M-L" and we'll populate it with "WWW" and then a couple of spaces and type "Static." "Ctrl-x" to leave, "Y" to accept the changes then "Enter." Now let's try "dotcloud Push" to push our app up to the dotCloud hosting service.
 
We're done. The last line of the install process tells us that the application is live at this url. Let's copy it.
 
"Shift-ctrl-c" by the way will copy using the keyboard from a console, which can be very useful and it is exactly the way we had created it. Our first dotCloud application is up and running.

Comments

Popular posts from this blog

Cloud Computing in simple

How to Write an Effective Design Document

Bookmark