jessewei

Laboratory to bluemix, a cloud solution exercise to etl scheduler

Run the web app

Run images the same way you did locally but without any worry of keeping your laptop on all day!

  • Check images are in your Bluemix hosted registry

     $ cf ic images
     REPOSITORY                                        TAG 
     registry.ng.bluemix.net/web1/lets-chat           latest              
     registry.ng.bluemix.net/web1/mongo               latest              
     
    
  • Run Mongo container

  Just like locally, except this time use cf ic instead of docker to point to Bluemix.

$ cf ic run --name lc-mongo -p 27017 -m 512 registry.ng.bluemix.net/web1/mongo

  • Show the running container instances

    Wait for a state of RUNNING before you proceed:

    $ cf ic ps
    CONTAINER ID        IMAGE                                                       
    7ebf51a3-35a        registry.ng.bluemix.net/web1/mongo:latest   ""
    
  • Run  Let’s Chat container

    $ cf ic run --name lets-chat --link lc-mongo:mongo -p 8080 -m 256 registry.ng.bluemix.net/web1/lets-chat

    a5dc5e0d-8eae-44a2-9f8d-548112bec250

    Show the running container instances. Wait for a state of RUNNING before you proceed:

    $ cf ic ps
    CONTAINER ID        IMAGE                                                                
    d368a598-69d        registry.eu-gb.bluemix.net/web1/lets-chat:latest
    7ebf51a3-35a        registry.eu-gb.bluemix.net/web1/mongo:latest       
  • Expose Let’s Chat container to the public Internet

    The IBM Containers command line tool will attempt to expose your container for you if you have room left in your Public IP Address quota.

    Check which IPs are available and then bind one to your running container.

    $ cf ic ip list
    Number of allocated public IP addresses:  2
    
    IpAddress        ContainerId   
    134.XXX.YYY.ZZ0       
    134.XXX.YYY.ZZ1
    

    If you have no available IP addresses in the response, you can request one:

    $ cf ic ip request
    Successfully requested ip 134.XXX.YYY.ZZZ
    

     

  • Bind an available IP address

    $ cf ic ip bind 134.XXX.YYY.ZZZ lets-chat
    OK
    The IP address was bound successfully
    

    Show running containers with bound IP information now visible:

    $ cf ic ps
    CONTAINER ID        IMAGE 
    d368a598-69d        registry.ng.bluemix.net/web1/lets-chat:latest   ""
    7ebf51a3-35a        registry.ng.bluemix.net/web1/mongo:latest       ""     
                 
  • Running app in browser

    At the IP you just bound. Remember to use port 8080!

Conclusion

Congratulations, you have successfully completed this IBM Containers lab!. In this lab, you learned how to tag and push local images to Bluemix, inspect pushed images for security vulnerabilities, and run hosted multi-container applications on IBM Containers.

Now you can take the hands-off approach to all your future application deployments!

Cleanup

If you plan to do another lab, you need to clean up your container instances. This can be done through the UI and the DELETE button on each container, or you can do this through the CLI with the cf ic rm -f [CONTAINER_NAME] command.

$ cf ic rm -f lets-chat
$ cf ic rm -f mongo
 
Advertisements

Single Post Navigation

One thought on “Run the web app

  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: