You can run Docker containers on Bluemix by using the Containers compute option. Containers are a great option when you require resource isolation and the portability of your applications and application runtime environments. IBM Containers are based upon Docker container technology. With containers, you have the ability to move dockerized or containerized application environments quickly from development to test, pre-production or production. Additionally, with containers, you can also build highly available applications by using what is called container groups, which are clustered containers, having the same application environment or built from same container image. You can also enable auto recovery while creating a container group; by doing so, new container instances are automatically created if and when any of the already existing containers in the container group go down. A container group can be created even with a single instance of container.
To get a detailed understanding of how IBM Containers leverage Docker technology, you can refer to https://ibm.biz/Bdrd67 .
If you are already a Docker user, you can bring your Docker images from Docker Hub to a private registry hosted by IBM and you will be able to use the same images to create containers on Bluemix that are same as the Docker containers you have worked on.
To know how to go about copying your images from Docker Hub to the IBM registry, you can refer to https://ibm.biz/BdrdUX .
In this section, we will learn how to create an IBM Container instance from IBM-provided images. To get the Liberty server in a container, we will build a container from an existing image.
There are a few utilities that are required to be installed locally on your machine, so that you can work with IBM Containers on Bluemix. Make sure you have the following supported versions of utilities installed:
Based on the operating system you are using, you will need to follow the instructions from the links shown here:
The screenshots shown in this section will correspond to Docker installation steps on OS X:
DockerToolbox-1.10.0.pkg
to your local system..pkg
file to start the installation of the Docker Toolbox.
The installation of Cloud Foundry CLI has been explained in an earlier chapter; if you are reading this chapter after carrying out the exercises and demos from earlier chapters then you should already have cf cli on your system. You can find the version of the cf cli by opening the terminal window or command prompt, based on your OS, and typing the following command:
cf -v
The results of running this command would give you the information on the version of CF CLI that you are using, such as what is shown here:
You will need to run the cf
command from the following table, based on the operating system you are working on:
OS X |
|
Windows 64-bit |
|
Windows 32-bit |
|
Linux 64-bit |
|
Linux 32-bit |
|
The installation steps are as follows:
cf install-plugin
https://static-ice.ng.bluemix.net/ibm-containers-mac
The following screenshot shows the output generated:
cf plugins
The results of execution are displayed as shown in the following screenshot. You will see the IBM Containers plugin listed as one of the cf
plugins installed:
We will now learn to create a single container using the Bluemix dashboard.
You can also create scalable container groups on Bluemix; for detailed steps on how to create them, you can refer to https://ibm.biz/BdrxyN .
The following are the steps to create a single container:
Once the public IP is bound to your container, you can see it as shown in the screenshot here:
You can also bind Bluemix services to the container you have created. The Connections tab will show the services that are bound to your container:
You can now see the container you have created in the dashboard view for your Containers compute option, as shown here:
Before you can start working with Cloud Foundry IBM Containers plugin, you will need to run the following command from your terminal window or from the command prompt, based on the operating system you are using:
cf ic init
The results of execution of the command is show here:
To get the details on the container that you just created, so as to work with it using the command line plugin, you will need to execute the following command:
cf ic ps
This command will list all the containers you have created within your Bluemix organization.
The result of execution of this command is shown in the following screenshot; you will see the single container that we just created is listed along with other details about the container such as its ID, name, and so on:
For a detailed reference on the cf cli IBM Containers plugin commands, you can refer to https://ibm.biz/BdrxMD .
18.191.157.197