This article, the last entry in my IBM Bluemix series for beginners, will provide you with a brief overview on using Bluemix containers, which are basically just virtual collections of software applications packaged as images running as isolated processes on the host operating system helping you build high-quality apps more efficiently while enjoying the benefits of resource isolations.
To get started, click on Containers > Create a Container on your dashboard and you will see the following:
Enter a name for your private container registry to proceed – this name will be needed to access your list of container images later. Next, select an image to be used for your newly created container:
Two default images are provided, ibmliberty and imbnode for WebSphere Liberty and Node.js application server respectively. For now, just select any of them to proceed to the next step. You will be prompted to select an existing Bluemix app that will bind to, e.g. make use of, this containter:
The user interface also allows you to select a storage volume that the container can use. However, as you may have noticed, the list is greyed out. This is because volumes can only be created from the CloudFoundry command line at the moment and we have not yet created any. For now, just check the settings and click Deploy. After a while the container will appear in the list with its associated IP:
Interestingly, there is also another list of containers inside the Cloud Management Dashboard which is still empty. Much like the virtual machine list, probably these two lists are not in sync:
At this point, the container is created. But what can you actually do with it? Unfortunately the dashboard does not provide many options to play with, only the container usage overview and options to view the logs:
To do something useful with it, you need to resort to the CloudFoundry command line. Install the IBM Container Extension (ICE) following the documentation and log in to your Bluemix account from ICE:
$ ice login API endpoint: https://api.ng.bluemix.net Email> ****** Password> ******** Authenticating... OK API endpoint: https://api.ng.bluemix.net (API version: 2.19.0) User: email@example.com Org: toughdev Space: toughdev Authentication with container cloud service at https://api-ice.ng.bluemix.net/v2/containers completed successfully You can issue commands now to the container service Proceeding to authenticate with the container cloud registry at registry-ice.ng.bluemix.net Login Succeeded
After that run the following, replacing the private registry name with the name you have chosen earlier:
$ ice --local run registry-ice.ng.bluemix.net/mrtoughdev echo "hello world"
You will see the following output of the echo command:
Target is local host. Invoking docker with the given arguments... hello world
The maching powering the container runs on Linux, so you can try other bash commands as normal.
To find out the list of images currently available on your registry, use ice image:
$ ice images Image Id Created Image Name d0feae99-b91d-4ce3-bcb4-6128886f6968 Mar 23 10:44:59 2015 registry-ice.ng.bluemix.net/ibmliberty:latest 74831680-1c9c-424e-b8ea-ceede4aa0e40 Mar 23 10:41:24 2015 registry-ice.ng.bluemix.net/ibmnode:latest
For other interesting stuff that you can do with containers, including installing the iputils-ping package so that you can ping other machines from your container, refer to this tutorial. There is even a simulator on that page allowing you to practice ICE commands without having to install it locally.
This article concludes my basic IBM Bluemix series. I hope the information provided in the last few articles have been useful for those who want to learn more about IBM Bluemix. In the next few articles I will be writing more about advanced features that you can use on Bluemix, for example using IBM Watson for facial recognition and other artcifical intelligence tasks. Stay tuned for more updates!