jessewei

Laboratory to bluemix, a cloud solution exercise to etl scheduler

Push images to Bluemix

It is time to tag them for use in IBM Containers on Bluemix. To do so, you will need to tag them with the repository name you created when you setup your Bluemix account for IBM Container usage.

  • Log in to Bluemix

     $ cf login
     API endpoint: https://api.ng.bluemix.net
    
     Email> jessewei@tw.ibm.com
    
     Password>
     Authenticating...
     OK
    Targeted org jessewei@tw.ibm.com
    
    Select a space (or press enter to skip):
    1. BAO-TW
    2. Scheduler
    
    Space> 1
    Targeted space BAO-TW
     
  • Log into the IBM Containers service

     $ cf ic login
    Deleting the old configuration file...
    Retrieving client certificates from IBM Containers...
    ....
      Example Usage:
      docker ps
      docker images
    
  • First tag your MongoDB image.

  • Remember to use your namespace from the first command below to replace[NAMESPACE] in the tag and push commands below.List your images:
    $ docker images
    REPOSITORY                                               TAG
    mongo                                                    latest
    sdelements/lets-chat                                     latest
    

    Make note of your namespace:

    $ cf ic namespace get
    web1
    

    Tag your Mongo image in a Bluemix-compatible format:

    $ docker tag mongo registry.ng.bluemix.net/web1/mongo
    

    List your images again, now showing the newly tagged image:

    $ docker images
    REPOSITORY                                               TAG
    mongo                                                    latest
    registry.ng.bluemix.net/web1/mongo                       latest
    sdelements/lets-chat                                     latest
    

    The IMAGE ID stays the same and allows us to reuse the existing container image as-is.

  • Next, tag your Let’s Chat image.

  • Push commands below.Tag your Let’s Chat image in a Bluemix-compatible format:
    $ docker tag sdelements/lets-chat registry.ng.bluemix.net/web1/lets-chat
    

    List your images again, now showing the newly tagged image:

    $ docker images
    REPOSITORY                                               TAG
    ...
    
  • Wrap  Let’s Chat image with a simple Dockerfile

    To ensure network connectivity, create a new directory called wrapper

    $ mkdir wrapper
    

    Switch to that directory and run the following command to create a Dockerfile

    $ cd wrapper
    $ echo "FROM sdelements/lets-chat:latest" > Dockerfile
    $ echo "CMD (sleep 60; npm start)" >> Dockerfile
    

    This will create a new Dockerfile that we can build a temporary image from.

    $ docker build -t registry.ng.bluemix.net/web1/lets-chat .
    

    Use this image below to push to Bluemix instead of the base lets-chat image.

  • Push to private registry on Bluemix.

    This allows the IBM Container service to run your container images on the cloud.

    Push your Mongo image to your Bluemix registry:

    $ docker push registry.ng.bluemix.net/web1/mongo
    The push refers to a repository [registry.ng.bluemix.net/ibm_containers_demo_eu/mongo] (len: 1)
    Sending image list
    Pushing repository registry.ng.bluemix.net/web1/mongo (1 tags)
    ...
    Pushing tag for rev [202e2c1fe066] on {https://registry.ng.bluemix.net/v1/repositories/web1/mongo/tags/latest}
    

    Push your Let’s Chat image to your Bluemix registry:

    $ docker push registry.ng.bluemix.net/web1/lets-chat
    The push refers to a repository [registry.ng.bluemix.net/web1/lets-chat] (len: 1)
    Sending image list
    ...
    Pushing tag for rev [2409eb7b9e8c] on {https://registry.ng.bluemix.net/v1/repositories/web1/lets-chat/tags/latest}
    

    Now your images are up in the cloud, in your hosted registry, and ready to run on Bluemix! But first, take a moment to understand what is inside the images you just pushed!

Advertisements

Single Post Navigation

One thought on “Push images to Bluemix

  1. Pingback: Bluemix Lab @ Windows | jessewei

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: