At DockerCon Europe today we announced the availability of the beta of our new IBM container service on Bluemix. As a developer you can now leverage the power of Docker to deploy a container on Bluemix. The IBM Containers service is super easy to use. No need to deploy and manage Virtual Machines, set up Docker engine, or manage your own registries. And it is loaded with powerful capabilities.
- Native container hosting, no need to manage the docker infrastructure yourself
- Powerful networking, including support for real IP addresses on containers and private networking between your containers
- Support for private Docker image registries, allowing you to store and share your images within your Organization
- Integration with other services in Bluemix, allowing you to bind others services to your container application with ease
- Standard IBM images for WebSphere Liberty and Node.js runtime environments
- All based on standard Docker runtime and APIs
Getting StartedSimply log into your Bluemix account, go to the catalog and select the “IBM Containers” service. You are allowed a single instance of the service per Organization in Bluemix. Right now for the beta you will be allowed to 2GB of memory, 2 Public IP addresses to attach to your containers, and 8 containers total. These limits will change in the future. Create the instance as normal. Demand for the service is high right now, so once you create the service you may be placed in the queue and receive a notification like this. Once your service instance is activated you will see the getting started screen. You will be asked to provide a name for your private Docker image registry. You will also see your API key that you will need to access the service from your command line. Make sure you have docker and the IBM Containers (ice) tools installed on your machine using the instructions provided.
Run a ContainerLet’s get started and run a container. The IBM Containers service comes with images for WebSphere Liberty and Node.js. And of course you can use any image from Docker Hub. Let’s use the Liberty image to start a basic application service container. That is easy to do. Simply do the following:
> ice run --name liberty registry-ice.ng.bluemix.net/ibmlibertyThis will launch your container on bluemix and give it a private IP address. Run “> ice ps” to see the running instance. You should get something like this: In order to send a request to this container you need to give it a public IP. This is easy as well. First request a public IP address.
$ ice ip request Successfully obtained ip: "18.104.22.168"Now attach that IP address to your running container
$ ice ip bind 22.214.171.124 liberty Successfully bound ipIf you run “ice ps” again you will see that the container is now accessible on the new IP address. You can then go to that IP address to access your container.
Use a custom imageLet’s do one last thing. Let’s add an application to that WebSphere Liberty Image and run the new image. To do this we are going to build a new image using Dockerfile. To start lets pull the Liberty image to your local machine.
$ docker pull registry-ice.ng.bluemix.net/ibmlibertyNext lets create a Dockerfile with your app in it. For this example I am using a simple hello WAR file. Your Dockerfile would look something like this.
>> FROM registry-ice.ng.bluemix.net/ibmliberty ADD hello.war /opt/ibm/wlp/usr/servers/defaultServer/dropins/ ENV LICENSE acceptNow you can build the image
$ docker build -t hello .Now that we have our new image lets push it to your private registry on the IBM Containers service and run it. To push it do the following:
$ docker tag hello registry-ice.ng.bluemix.net/Now all you have to do is run it like above and bind the IP address.
/hello (replace with the private registry namespace you selected at the beginning) $ docker push registry-ice.ng.bluemix.net/ /hello
$ ice run --name hello registry-ice.ng.bluemix.net/
/hello $ ice ip bind < address> hello