heidloff.net - Building is my Passion

Cheatsheet for Docker and IBM Bluemix Containers Beginners

As a developer I prefer graphical tools since I often cannot remember all the different commands for various CLIs (command line interfaces). In cases where I have to use CLIs I write down my own little cheatsheets with the commands I use most often. Below is a minimal set of commands to create Docker images and containers running a Java Liberty application and deploy them to IBM Bluemix.

For more information check out the official Docker CLI documentation and the IBM Containers CLI documentation. To interact with Bluemix I use below the IBM Container plugin for Cloud Foundry which you need to install in addition to Docker and the Cloud Foundry CLI.


List all images:
docker images

Remove image:
docker rmi _image_tag_

List all containers:
docker ps -a

Remove container:
docker stop _container_name_
docker rm _container_name_

Build image:
docker build -t _image_tag_ .

Run container:
docker run –name _container_name_ -p 80:80 -p 443:443 -d -t _image_tag_

Launch application:
boot2docker ip
browser: http:// _your_ip_

IBM Containers

cf login
cf ic login

List all images:
cf ic images

Remove image:
cf ic rmi registry.ng.bluemix.net/_your_namespace_/_image_tag_

List all containers:
cf ic ps -a

Remove container:
cf ic stop _container_name_
cf ic rm _container_name_

Push image:
docker tag _image_tag_ registry.ng.bluemix.net/_your_namespace_/_image_tag_
docker push registry.ng.bluemix.net/_your_namespace_/_image_tag_

Run container:
cf ic run –name container_name -p 80:80 -p 443:443 -d -t registry.ng.bluemix.net/_your_namespace_/_image_tag_

Manage IP addresses:
cf ic ip request
cf ic ip list -a
cf ic ip bind _your_ip_ _container_name_

Launch application:
browser: http:// _your_ip_

Sample Liberty Application

I’ve implemented a simple hello world Liberty application. In order to deploy it to Bluemix you can use the commands above. Here is the Dockerfile which copies the server configuration and the web application.


I’ve configured Liberty to use the ports 80 and 443, but you can also leave the defaults and change the port mappings in the commands above.



Featured Blog Posts
The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.
Trending Tags