Get CONTAINER-ized via Bluemix CLI

In this post, you will learn how to create and push a docker container to Bluemix via CLI. The post includes

  • Steps to setup and use Bluemix CLI.
  • Creating and Running your container on IBM Bluemix.

I have been exploring and playing with Containers more specifically Docker Containers for a while now and same is the case with IBM Cloud. Just thought how about exploring both the worlds together. Then there was an option to create a container on Bluemix.

docker containers on Bluemix

Setting up bx CLI

Bluemix CLI is supported on all the major Operating systems.. Just to keep the blog post compact and simple, I will be running all the commands on macOS terminal.

  • Bluemix Account – Signup / Login
  • Docker CLI
  • Before installing Bluemix Cli install Cloud Foundry CLI
  • Download Bluemix CLI from here 

Command to check whether Bluemix(bx) CLI is installed,

To check the version of your installation,

To update your Bluemix CLI, run the below command

Plugins

Like Cloud Foundry CLI, Bluemix CLI supports a plug-in extension framework to integrate other commands besides the built-in ones.

  • To install Bluemix CLI plug-ins from the Bluemix registry, set the plug-in registry endpoint:

  • Then, run the following command to install a IBM Container (ic) plug-in:

Replace IBM-Containers with any plugin-name you want to install

To update a plugin, run the below command

To confirm that you are good to create a container via Bluemix CLI, run the below command

where bx stands for Bluemix and ic stands for IBM containers

You should see all IBM-Container commands.

Creating your first container on Bluemix

Before creating your  container on Bluemix, you should login with the command below

Let’s generate client certificates for IBM Containers to initialise the containers environment on your local machine to use the full capabilities of the IBM Containers service.Run the below command

Set the name of the private Bluemix image repository the organization that you are logged in to.

Restriction: You can’t use a hyphen - in the name of your repository namespace.

Now,The path to any image under your private registry will be registry.ng.bluemix.net/<namespace-name>/<image-name>

To read your namespace anytime, run the below command

To check the images, run the below command

Using the below command you can move an image from public registry like DockerHub to your private registry on Bluemix

By running the above command you are copying hello-world image to your private registry under your own namespace.

Let’s run our container on Bluemix

Output:

Run this below command to see all the containers under your private registry on Bluemix

You can run “docker COMMAND –help” for more information on commands that are followed by (Docker) and

for IBM Containers commands.

Use “export BLUEMIX_TRACE=true” or “bluemix ic COMMAND -v|–verbose [COMMAND OPTIONS] [ARGUMENTS…]” to enable debug mode.

For a full list of CLI commands, see the IBM Containers documentation 

Refer this link for more Bluemix Plugins

In the subsequent posts you will see how to Container-ize an existing NodeJS app (Refer this Github Repo) by drafting a Dockerfile and run it on Bluemix.Followed by an introduction to the new IBM Container service and its CLI commands.

Polyglot & Pragmatic Programmer • Developer Advocate, IBM Cloud • Intel software Innovator • DZone MVB
(Visited 167 times, 1 visits today)

You may also like...

Show Buttons
Hide Buttons