Wednesday, April 27, 2016

Bluemix Containers - Hello BusyBox

BusyBox can be used as a lightweight Docker image to run a set of UNIX tools and test that Docker has been configured properly.  This document demonstrates running the BusyBox Docker image in IBM Bluemix.  


Create an IBM Bluemix account

    IBM Bluemix can be used with a free trial account by signing up on  Sign up for IBM Bluemix to start using Bluemix and Bluemix Containers.

Getting started with Bluemix Containers

    Bluemix Containers requires a Docker Engine installation, along with Cloud Foundry CLI and the IBM Containers Extension.  See the official Bluemix Documentation for additional configuration/installation details.

Install Docker Engine
    Details for installing Docker Engine:
Install Cloud Foundry CLI
    cd /usr/bin    
    curl -L "" | tar -zx
Install IBM Containers Extension


Run your first image using Bluemix Containers

    The following steps document how to run an interactive BusyBox example using Bluemix Containers.
Login to Bluemix using Cloud Foundry CLI:
    cf login -a
        Email> (Bluemix account email)
        Password> (Bluemix account password)
        Org> (Bluemix account org)
Login to IBM Containers:
    cf ic login
List the Bluemix Container namespace:
    cf ic namespace get
Set the Bluemix Container namespace (if not already set):
    cf ic namespace set <Namespace>
Pull the latest BusyBox image locally from Docker Hub:
    docker pull busybox:latest
Prepare the BusyBox image with tags matching your Bluemix Container namespace:

    docker tag busybox:latest

Push the image to your Bluemix Registry:   
    docker push<Namespace>/busybox:latest

Run the BusyBox Docker container using Bluemix Containers:
    cf ic run -it

Execute any BusyBox command from the running container: Busybox commands reference.  Type exit to quit the BusyBox container session.

Next steps

    Now that you have successfully ran the BusyBox Docker image using Bluemix Containers, you can run other Docker images on Bluemix.  Try pulling another public image from Docker Hub, or building your own Docker image using a Dockerfile.