IBM Cloud Services — Docker Setup
I want publish a docker image in the IBM Cloud Platform … why? Becase with our team, we are analyzing the possibility to send an idea to the Hackathon CallForCode sponsored for the ONU and IBM, and, one of the first requisites is to use the IBM Cloud services or IBM Systems. …
So, the question is: How complex, or tricky is to achieve it?
Prerequisites:
- I already have a free account in the IBM Cloud platform
- I already had installed the “ibmcloud” (basic) CLI on my notebook
- I already have a public github repo with a public Angular app for demo purposes, and a Dockerfile related to it, that let us build de docker image
- Also, I already have the docker image that I want to publish in the IBM Cloud Platform with an Angular app inside it. This docker image is available in docker hub, but, we don´t need to use it for this post.
Let´s Start
So, after all of it, I am ready to follow the specific steps to run the docker image in the IBM cloud platform, that are in this link after “IBM Cloud” title
$ ibmcloud cr namespace-add pabloeze
FAILED
'cr' is not a registered command. See 'ibmcloud help'..... etc
$ ibmcloud plugin install container-registry -r 'IBM Cloud'
.... etc
$ ibmcloud cr namespace-add pabloeze
Adding namespace 'pabloeze'...Successfully added namespace 'pabloeze'OK
Ok, I have to install first a “cr” plugin, and now, I have a “pabloeze” namespace,
Now, let´s publish the docker image on the IBM cloud Registry
$ ibmcloud cr build --tag registry.ng.bluemix.net/pabloeze/healthydata:v1.0 . 1
Sending build context to Docker daemon 82.24MB
Step 1/13 : FROM node:10.16.0 as build
10.16.0: Pulling from library/node
a4d8138d0f6b: Pull complete
dbdc36973392: Pull complete
f59d6d019dd5: Pull complete
aaef3e026258: Pull complete....Removing intermediate container 6d6c67b1ae2c
---> a01ced370bf0
Successfully built a01ced370bf0
Successfully tagged private.us.icr.io/pabloeze/healthydata:v1.0
The push refers to repository [private.us.icr.io/pabloeze/healthydata]
2c6282500b0c: Pushed
6081fcfa9e5b: Pushed
2bdf88b2699d: Pushed
f1b5933fe4b5: Pushed
v1.0: digest: sha256:7d4beeab5dafdc21821f07321d96cf978e7fa3ee0481409a3f9a4f28141df86e size: 1163OK
The registry
$ ibmcloud cr image-list
Listing images...Repository Tag Digest Namespace Created Size Security status
us.icr.io/pabloeze/healthydata v1.0 7d4beeab5daf pabloeze 13 minutes ago 40 MB 22 IssuesOK
And the Docker Run for it
$ docker run -d -p 80:80 us.icr.io/pabloeze/healthydata:v1.0
Unable to find image 'us.icr.io/pabloeze/healthydata:v1.0' locally
docker: Error response from daemon: Get https://us.icr.io/v2/pabloeze/healthydata/manifests/v1.0: unauthorized: authentication required.
See 'docker run --help'.
So, we need to login (after a while of some weeks … I needed to make a “ibmcloud login” again ..)
$ ibmcloud cr login
Logging in to 'registry.ng.bluemix.net'...
Logged in to 'registry.ng.bluemix.net'.Logging in to 'us.icr.io'...
Logged in to 'us.icr.io'.OK
Now, we are ready! Let´s run the docker from IBM Cloud
$ docker run -d -p 80:80 --name healthyApp us.icr.io/pabloeze/healthydata:v1.0
00d51926323bd2f8f8597cbfc51dfedb8adb5f349085bc0cf9fc5855e5168768
And the docker is alive, on http://localhost:80 running the Angular App inside it
So, let´s stop the post here ….
With the goal accomplished: to publish a docker image on IBM Cloud Platform and run it
Resources
This post is based on following the steps on:
The source code to build & run the angular demo app, with the Dockerfile inside it to build the docker. is available on: