IBM Containers on Bluemix using the command line and existing Docker images

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page

rosen2

In a previous post, I wrote about the top five game-changing capabilities of IBM Containers on Bluemix, and how you can get started using the UI. But if you’re a developer, you may want to perform the same tasks using the command line. Let’s take a look at how you can leverage the command line for IBM Containers, as well as how to work with existing Docker images.

Assuming you are already registered to use IBM Containers on Bluemix, deploying new containers can be accomplished with the following steps. Per the documentation, install Docker, Cloud Foundry CLI, Python, and IBM Containers Extension (ICE) before getting started.

IBM Containers via Command Line:

1. Log into IBM Bluemix with your Bluemix account.  After you enter your email address and password, you will be prompted to select the desired space if you have more than one.

  • ice login

7

2. Display images available on the cloud.

  • ice images

8

3. Start a container on IBM Bluemix from the Liberty image and then monitor the deployment status.

  • ice run –name liberty1 ibmliberty:latest
  • ice ps | grep liberty1

9

4. Download this image to the local system.

  • ice –local pull registry-ice.ng.bluemix.net/ibmliberty:latest

10

5. Start a container on the local system from the Liberty image

  • ice –local run registry-ice.ng.bluemix.net/ibmliberty:latest

11

12

IBM Containers Leveraging Your Existing Docker Images:

You can also move existing Docker images from your private cloud and run them with a public IP hosted in IBM Bluemix.

1. Log into IBM Bluemix with your Bluemix account.  After you enter your email address and password, you will be prompted to select the desired space if you have more than one.

  • ice login

2. Tag your local Docker image to prepare for uploading to the Bluemix cloud.  In this example, the “wordpress” image is an existing Docker image that has either been downloaded from Docker Hub or custom built, but now you are ready to deploy this image in IBM Containers to leverage the capabilities within the IBM Bluemix catalog.

  • ice –local tag -f wordpress registry-­ice.ng.bluemix.net/<namespace>/wordpress-cr

13

14

3. Push (upload) the image to the Bluemix hosted registry

  • ice –local push registry-ice.ng.bluemix.net/<namespace>/wordpress-cr

15

4. Display the images available in the registry

  • ice images | grep wordpress

16

5. Instantiate a new instance of this image, running on the IBM Bluemix cloud.

  • ice run –name mywordpress registry-ice.ng.bluemix.net/<namespace>/wordpress-live:latest

17

6. Request a public IP address to ensure the container is accessible by other users.

  • ice ip request

7. Bind the newly acquired public IP address to the running container

  • ip bind 1.2.3.4 <Container_ID>

18

Be sure to start your FREE trial today!

Now that you have seen both, do you prefer the UI or CLI? Let’s continue the discussion in the comments below, or you can reach out to me on Twitter @ChrisRosen188.

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page
Chris Rosen
Chris Rosen is a Technical Product Manager for IBM Containers within IBM Cloud Business Unit. With over fifteen years’ experience, he has held a variety of roles within the organization. Currently, Chris is responsible for interfacing with development and design teams for IBM Bluemix, gathering and understanding customer requirements, and determining future product plans. He has a Bachelor of Science in Information Technology and a Masters of Business Administration, both from Rochester Institute of Technology. Chris also holds certifications for MCSA, MCSE, CCNA, ITIL, and OpenGroup IT Specialist.
Chris Rosen

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *