Geeking in technology since 1985, with IBM Development, focused upon Docker and Kubernetes on the IBM Z LinuxONE platform In the words of Dr Cathy Ryan, "If you don't write it down, it never happened". To paraphrase one of my clients, "Every day is a school day". I do, I learn, I share. The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions. Remember, YMMV https://infosec.exchange/@davehay
Thursday, 31 August 2017
Wednesday, 30 August 2017
Tinkering with IBM Containers on IBM Bluemix - Like Docker really ...
As per previous posts, I have been tinkering with IBM Containers (IC) on IBM Bluemix, and am starting to bring things together in my mind, in terms of positioning IC vs. Kubernetes vs. Docker.
One of the many things that I like is the amount of help and choices that one has.
Having initialised the Bluemix ( bc ) Cloud Foundry ( cf ) IBM Containers ( ic ) environment: -
bx cf ic init
Invoking 'cf ic init'...
Deleting old configuration file...
OK
Generating client certificates for IBM Containers...
Client certificates are being stored in /Users/foobar/.ice/certs/...
Client certificates are being stored in /Users/foobar/.ice/certs/containers-api.eu-gb.bluemix.net/21377cbf-6e5f-4a9a-175a-4fdfeb3c3e12...
OK
Client certificates were retrieved.
Checking local Docker configuration...
OK
Authenticating with registry at host name registry.eu-gb.bluemix.net
OK
You are authenticated with IBM Bluemix Container Registry.
Your private Bluemix repository is URL: registry.eu-gb.bluemix.net/foobar
No ic-cfg.ini found on the system. Creating...
You can choose from two ways to use the Docker CLI with IBM Containers:
Option 1: This option allows you to use 'cf ic' for managing containers on IBM Containers while still using the Docker CLI directly to manage your local Docker host.
Use this Cloud Foundry IBM Containers plug-in without affecting the local Docker environment:
Example Usage:
cf ic ps
cf ic images
Option 2: Use the Docker CLI directly. In this shell, override the local Docker environment to connect to IBM Containers by setting these variables. Copy and paste the following commands:
Note: Only Docker commands followed by (Docker) are supported with this option.
export DOCKER_HOST=tcp://containers-api.eu-gb.bluemix.net:8443
export DOCKER_CERT_PATH=/Users/foobar/.ice/certs/containers-api.eu-gb.bluemix.net/21377cbf-6e5f-4a9a-175a-4fdfeb3c3e12
export DOCKER_TLS_VERIFY=1
Example Usage:
docker ps
docker images
Deleting old configuration file...
OK
Generating client certificates for IBM Containers...
Client certificates are being stored in /Users/foobar/.ice/certs/...
Client certificates are being stored in /Users/foobar/.ice/certs/containers-api.eu-gb.bluemix.net/21377cbf-6e5f-4a9a-175a-4fdfeb3c3e12...
OK
Client certificates were retrieved.
Checking local Docker configuration...
OK
Authenticating with registry at host name registry.eu-gb.bluemix.net
OK
You are authenticated with IBM Bluemix Container Registry.
Your private Bluemix repository is URL: registry.eu-gb.bluemix.net/foobar
No ic-cfg.ini found on the system. Creating...
You can choose from two ways to use the Docker CLI with IBM Containers:
Option 1: This option allows you to use 'cf ic' for managing containers on IBM Containers while still using the Docker CLI directly to manage your local Docker host.
Use this Cloud Foundry IBM Containers plug-in without affecting the local Docker environment:
Example Usage:
cf ic ps
cf ic images
Option 2: Use the Docker CLI directly. In this shell, override the local Docker environment to connect to IBM Containers by setting these variables. Copy and paste the following commands:
Note: Only Docker commands followed by (Docker) are supported with this option.
export DOCKER_HOST=tcp://containers-api.eu-gb.bluemix.net:8443
export DOCKER_CERT_PATH=/Users/foobar/.ice/certs/containers-api.eu-gb.bluemix.net/21377cbf-6e5f-4a9a-175a-4fdfeb3c3e12
export DOCKER_TLS_VERIFY=1
Example Usage:
docker ps
docker images
it's great to see that I can use either cf ic commands: -
cf ic ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3cf533af-c95 registry.eu-gb.bluemix.net/foobar/db2expressc:pamfixed "db2start " 8 days ago Running 134.168.59.83:50000->50000/tcp db2
3cf533af-c95 registry.eu-gb.bluemix.net/foobar/db2expressc:pamfixed "db2start " 8 days ago Running 134.168.59.83:50000->50000/tcp db2
cf ic images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.eu-gb.bluemix.net/ibmnode v1.2 b1667ce7e5af 2 weeks ago 183MB
registry.eu-gb.bluemix.net/ibmnode v1.1 18f8f073b62b 2 weeks ago 176MB
registry.eu-gb.bluemix.net/ibm-websphere-extreme-scale latest 8fccb460321a 7 weeks ago 466MB
registry.eu-gb.bluemix.net/ibm-integration-bus latest 4b5f5fb39008 4 weeks ago 698MB
registry.eu-gb.bluemix.net/ibm_wa_agent latest db7dc2abff64 4 months ago 435MB
registry.eu-gb.bluemix.net/ibm-mq latest b42d55b53b18 8 days ago 455MB
registry.eu-gb.bluemix.net/ibmliberty webProfile7 cd826253309d 7 weeks ago 268MB
registry.eu-gb.bluemix.net/ibmnode v4 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibmnode latest 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibm-backup-restore latest ea90ec45b636 4 weeks ago 205MB
registry.eu-gb.bluemix.net/ibm-node-strong-pm latest 9499f23eb689 4 months ago 281MB
registry.eu-gb.bluemix.net/ibmliberty webProfile6 b350d9fd08fd 7 weeks ago 260MB
registry.eu-gb.bluemix.net/ibmliberty latest edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty javaee7 edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty microProfile 4a50d0f49c6e 7 weeks ago 230MB
registry.eu-gb.bluemix.net/foobar/db2expressc pamfixed 968890871f71 8 days ago 640MB
registry.eu-gb.bluemix.net/ibmnode v1.2 b1667ce7e5af 2 weeks ago 183MB
registry.eu-gb.bluemix.net/ibmnode v1.1 18f8f073b62b 2 weeks ago 176MB
registry.eu-gb.bluemix.net/ibm-websphere-extreme-scale latest 8fccb460321a 7 weeks ago 466MB
registry.eu-gb.bluemix.net/ibm-integration-bus latest 4b5f5fb39008 4 weeks ago 698MB
registry.eu-gb.bluemix.net/ibm_wa_agent latest db7dc2abff64 4 months ago 435MB
registry.eu-gb.bluemix.net/ibm-mq latest b42d55b53b18 8 days ago 455MB
registry.eu-gb.bluemix.net/ibmliberty webProfile7 cd826253309d 7 weeks ago 268MB
registry.eu-gb.bluemix.net/ibmnode v4 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibmnode latest 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibm-backup-restore latest ea90ec45b636 4 weeks ago 205MB
registry.eu-gb.bluemix.net/ibm-node-strong-pm latest 9499f23eb689 4 months ago 281MB
registry.eu-gb.bluemix.net/ibmliberty webProfile6 b350d9fd08fd 7 weeks ago 260MB
registry.eu-gb.bluemix.net/ibmliberty latest edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty javaee7 edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty microProfile 4a50d0f49c6e 7 weeks ago 230MB
registry.eu-gb.bluemix.net/foobar/db2expressc pamfixed 968890871f71 8 days ago 640MB
-OR- docker commands: -
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3cf533af-c95 registry.eu-gb.bluemix.net/foobar/db2expressc:pamfixed "db2start " 8 days ago Running 134.168.59.83:50000->50000/tcp db2
3cf533af-c95 registry.eu-gb.bluemix.net/foobar/db2expressc:pamfixed "db2start " 8 days ago Running 134.168.59.83:50000->50000/tcp db2
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.eu-gb.bluemix.net/ibm-integration-bus latest 4b5f5fb39008 4 weeks ago 698MB
registry.eu-gb.bluemix.net/ibm_wa_agent latest db7dc2abff64 4 months ago 435MB
registry.eu-gb.bluemix.net/ibm-websphere-extreme-scale latest 8fccb460321a 7 weeks ago 466MB
registry.eu-gb.bluemix.net/ibm-mq latest b42d55b53b18 8 days ago 455MB
registry.eu-gb.bluemix.net/ibm-node-strong-pm latest 9499f23eb689 4 months ago 281MB
registry.eu-gb.bluemix.net/ibmnode latest 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibmnode v4 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibmnode v1.1 18f8f073b62b 2 weeks ago 176MB
registry.eu-gb.bluemix.net/ibmliberty webProfile7 cd826253309d 7 weeks ago 268MB
registry.eu-gb.bluemix.net/ibmliberty microProfile 4a50d0f49c6e 7 weeks ago 230MB
registry.eu-gb.bluemix.net/ibmliberty latest edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty javaee7 edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty webProfile6 b350d9fd08fd 7 weeks ago 260MB
registry.eu-gb.bluemix.net/ibm-backup-restore latest ea90ec45b636 4 weeks ago 205MB
registry.eu-gb.bluemix.net/ibmnode v1.2 b1667ce7e5af 2 weeks ago 183MB
registry.eu-gb.bluemix.net/foobar/db2expressc pamfixed 968890871f71 8 days ago 640MB
registry.eu-gb.bluemix.net/ibm-integration-bus latest 4b5f5fb39008 4 weeks ago 698MB
registry.eu-gb.bluemix.net/ibm_wa_agent latest db7dc2abff64 4 months ago 435MB
registry.eu-gb.bluemix.net/ibm-websphere-extreme-scale latest 8fccb460321a 7 weeks ago 466MB
registry.eu-gb.bluemix.net/ibm-mq latest b42d55b53b18 8 days ago 455MB
registry.eu-gb.bluemix.net/ibm-node-strong-pm latest 9499f23eb689 4 months ago 281MB
registry.eu-gb.bluemix.net/ibmnode latest 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibmnode v4 20020df7341b 2 weeks ago 188MB
registry.eu-gb.bluemix.net/ibmnode v1.1 18f8f073b62b 2 weeks ago 176MB
registry.eu-gb.bluemix.net/ibmliberty webProfile7 cd826253309d 7 weeks ago 268MB
registry.eu-gb.bluemix.net/ibmliberty microProfile 4a50d0f49c6e 7 weeks ago 230MB
registry.eu-gb.bluemix.net/ibmliberty latest edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty javaee7 edea51e84600 7 weeks ago 307MB
registry.eu-gb.bluemix.net/ibmliberty webProfile6 b350d9fd08fd 7 weeks ago 260MB
registry.eu-gb.bluemix.net/ibm-backup-restore latest ea90ec45b636 4 weeks ago 205MB
registry.eu-gb.bluemix.net/ibmnode v1.2 b1667ce7e5af 2 weeks ago 183MB
registry.eu-gb.bluemix.net/foobar/db2expressc pamfixed 968890871f71 8 days ago 640MB
You have a choice - and choices are good :-)
Friday, 25 August 2017
IBM BPM and Oracle - another interesting problem
Earlier this week, I was working with a client to grow their BPM development environment from two to four nodes, meaning that the Deployment Environment effectively doubled in size.
We achieved this by editing the template ( Advanced-PS-ThreeClusters-Oracle.properties ) and adding the additional two nodes, each hosting three new cluster members, and then using the BPMConfig.sh script to update the Deployment Environment as follows: -
./BPMConfig.sh -create -de Advanced-PS-ThreeClusters-Oracle.properties
Having done this, we started up the DE, and validated the changes by hitting the Process Portal, Process Admin and BPC UIs, and also stopping the old nodes ( 1 and 2 ) and ensuring that the service carried on running on nodes 3 and 4.
Apart from briefly forgetting to regenerate/propagate the WebSphere Plugin configuration and then restart IBM HTTP Server, all was well.
However, when we started the core business application ( which is an Enterprise Archive comprising SCA modules with mediations and BPEL flows ), we saw this in the SystemOut.log for all of the AppCluster members, both the original AND the new ones: -
java.lang.NoClassDefFoundError: oracle.xdb.XMLType
Caused by: java.lang.ClassNotFoundException: oracle.xdb.XMLType
at java.net.URLClassLoader.findClass(URLClassLoader.java:602)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:777)
at java.lang.ClassLoader.loadClass(ClassLoader.java:754)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:731)
at java.net.URLClassLoader.findClass(URLClassLoader.java:602)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:777)
at java.lang.ClassLoader.loadClass(ClassLoader.java:754)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:731)
Given that this had worked before the change and given that we know what the change was, this was somewhat weird.
This is covered here: -
*BUT* nothing has changed … apart from what has changed.
We dug further through the logs, but to no avail.
We then started to dig into the WebSphere Classloader, using this as source: -
and this: -
specifically by tracing the class loader : -
Enable Java™ Virtual Machine (JVM) classloader traces through the Admin console:
• Select Servers, choose Application servers and select the server you want to configure.
• In the Server Infrastructure section, open Java and Process Management and select Process Definition.
• Under Additional Properties, select Java Virtual Machine.
• Check the Verbose class loading checkbox.
• Add the following string to the Generic JVM arguments field:
-Dws.ext.debug=true -Dws.osgi.debug
-Dws.ext.debug=true -Dws.osgi.debug
• Click OK.
Once we did this, and looked at the trace, we could see that, whilst the Oracle JDBC driver ( ojdbc7.jar ) *WAS* being loaded ( and we could see that, partly because BPM was coming up and working, and partly because the JDBC Test Connection function worked for all of the databases, both BPM and application ), the requisite Oracle XML tool ( xdb6.jar ) was NOT being loaded.
However, when we looked at the configuration of the JDBC driver that was being used by the application-specific data source, it looked to be in order, similar to this: -
( although we're using the ojdbc7.jar rather than ojdbc6.jar as per the screenshot above ).
When we checked the underlying Linux file-system, we could see that ojdbc7.jar was present : -
ls -al /opt/ibm/WebSphere/AppServer/jdbcdrivers/Oracle/
total 6632
drwxr-xr-x 2 wasadmin wasadmins 40 Jul 10 19:59 .
drwxr-xr-x 5 wasadmin wasadmins 45 Jul 10 19:59 ..
-rw-r--r-- 1 wasadmin wasadmins 3389454 Jul 10 19:59 ojdbc6.jar
-rw-r--r-- 1 wasadmin wasadmins 3397734 Jul 10 19:59 ojdbc7.jar
drwxr-xr-x 2 wasadmin wasadmins 40 Jul 10 19:59 .
drwxr-xr-x 5 wasadmin wasadmins 45 Jul 10 19:59 ..
-rw-r--r-- 1 wasadmin wasadmins 3389454 Jul 10 19:59 ojdbc6.jar
-rw-r--r-- 1 wasadmin wasadmins 3397734 Jul 10 19:59 ojdbc7.jar
*BUT* that the xdb6.jar was NOT in the same location.
When we dug further, we could see that xdb6.jar was here: -
/opt/ibm/WebSphere/AppServer/lib/ext
along with ojdbc7.jar and xmlparserv2.jar.
which is interesting.
This then led the client to drill into the WebSphere Variable ORACLE_JDBC_DRIVER_PATH which is referenced at the JDBC driver level.
This was set to: -
${WAS_INSTALL_ROOT}/jdbcdrivers/Oracle
which is, in effect, this path: -
/opt/ibm/WebSphere/AppServer/jdbcdrivers/Oracle/
Looking at another environment, it was clear that, at some point in the past, this variable had been altered to point here: -
/opt/ibm/WebSphere/AppServer/lib/ext
rather than here; -
/opt/ibm/WebSphere/AppServer/jdbcdrivers/Oracle/
But, and here's the interesting part, the BPMConfig.sh script must've reset the variable back to the IBM-supplied default.
So, the moral of the story is two-fold; try and avoid altering IBM-provided variables AND learn how to debug the class loader in WAS :-)
Wednesday, 23 August 2017
IBM HTTP Server and HTTP Strict Transport Security (HSTS)
I was asked about this earlier today.
IBM HTTP Server (IHS), being based upon Apache, can do most whatever Apache itself can do.
This means that HTTP Strict Transport Security (HSTS) *can* be enabled in IHS.
I followed this blog post: -
and I can see the header being set: -
This is what I did in httpd.conf : -
Disabled HTTP
#Listen 8080
Enabled SSL and enforced TLS 1.2
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
Listen 8443
<VirtualHost *:8443>
SSLProtocolEnable TLSv12
SSLProtocolDisable SSLv2 SSLv3 TLSv10 TLSv11
SSLEnable
</VirtualHost>
KeyFile /opt/ibm/HTTPServer/ODM/ssl/keystore.kdb
SSLDisable
Added in mod_headers
LoadModule headers_module modules/mod_headers.so
Added in the appropriate HSTS header - using two years as an example expiration period ( 2 * 365 days * 24 hours * 60 minutes * 60 seconds )
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"
giving me this: -
LoadModule headers_module modules/mod_headers.so
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
Listen 8443
<VirtualHost *:8443>
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"
SSLProtocolEnable TLSv12
SSLProtocolDisable SSLv2 SSLv3 TLSv10 TLSv11
SSLEnable
</VirtualHost>
KeyFile /opt/ibm/HTTPServer/ODM/ssl/keystore.kdb
SSLDisable
with the configuration being validated using wget : -
wget --no-check-certificate https://odm.uk.ibm.com:8443/index.html --server-response
--2017-08-23 10:48:31-- https://odm.uk.ibm.com:8443/index.html
Resolving odm.uk.ibm.com (odm.uk.ibm.com)... fe80::20c:29ff:fe9a:9e56, 192.168.153.133
Connecting to odm.uk.ibm.com (odm.uk.ibm.com)|fe80::20c:29ff:fe9a:9e56|:8443... connected.
WARNING: cannot verify odm.uk.ibm.com's certificate, issued by '/CN=odm.uk.ibm.com':
Self-signed certificate encountered.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Wed, 23 Aug 2017 09:48:31 GMT
Strict-Transport-Security: max-age=63072000; includeSubdomains;
Last-Modified: Mon, 31 Oct 2016 10:10:36 GMT
ETag: "da5-540266b425f00"
Accept-Ranges: bytes
Content-Length: 3493
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Content-Type: text/html
Length: 3493 (3.4K) [text/html]
Saving to: 'index.html'
100%[================================================================================================================================================================>] 3,493 --.-K/s in 0s
2017-08-23 10:48:31 (357 MB/s) - 'index.html'saved [3493/3493]
and apachectl : -
/opt/ibm/HTTPServer/bin/apachectl -DDUMP_SSL_CONFIG -f /opt/ibm/HTTPServer/ODM/conf/httpd.conf
SSL configuration:
Default server
Server name: odm.uk.ibm.com:8080
SSL enabled: NO
SSL server defined at: /opt/ibm/HTTPServer/ODM/conf/httpd.conf:852
Server name: odm.uk.ibm.com:8443
SSL enabled: YES
FIPS enabled: 0
Keyfile: /opt/ibm/HTTPServer/ODM/ssl/keystore.kdb
Protocols enabled: TLSv12
Ciphers for SSLV2: (protocol disabled)
Ciphers for SSLV3: (protocol disabled)
Ciphers for TLSv10: (protocol disabled)
Ciphers for TLSv11: (protocol disabled)
Ciphers for TLSv12: (defaults) TLS_RSA_WITH_AES_128_GCM_SHA256(9C),TLS_RSA_WITH_AES_256_GCM_SHA384(9D),TLS_RSA_WITH_AES_128_CBC_SHA256(3C),TLS_RSA_WITH_AES_256_CBC_SHA256(3D),TLS_RSA_WITH_AES_128_CBC_SHA(2F),TLS_RSA_WITH_AES_256_CBC_SHA(35b),SSL_RSA_WITH_3DES_EDE_CBC_SHA(3A)
Syntax OK
Hope this helps.
Kubernetes and IBM Bluemix: How to deploy, manage, and secure your container-based workloads
A rather useful series of blog posts: -
which dovetails with my personal interests right now, given that I've just successfully brought up: -
(a) a containerised instance of IBM DB2 Express using Docker on my Mac
(b) the same on IBM Containers on IBM Bluemix
(c) the same but on Kubernetes on IBM Bluemix ( leveraging Clusters, Deployments, Pods and Nodes ).
My next challenge is to add WebSphere Liberty Profile into my Kubernetes cluster and see whether I can get a Java servlet talking via JDBC to DB2, which shouldn't be too hard #FamousLastWords
Meantime, enjoy the articles ...
Tuesday, 22 August 2017
Doh, IBM DB2 on the IBM Container Service on IBM Bluemix, remember persistence :-)
Having got DB2 running on the IBM Container Service on IBM Bluemix: -
I was a little perturbed when my Java code failed to work, when connecting from my Mac to the DB2 container: -
java -cp db2jcc4.jar:. JdbcTestDB2 54.23.128.93 50000 SAMPLE db2inst1 Qp455w0rd!
com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-1031, SQLSTATE=58031, SQLERRMC=null, DRIVER=4.23.42
I checked the SQL code: -
db2 ? sql1031
SQL1031N The database directory cannot be found on the indicated file
system.
Explanation:
The system database directory or local database directory could not be
found. A database has not been created or it was not cataloged
correctly.
The command cannot be processed.
User response:
Verify that the database is created with the correct path specification.
The Catalog Database command has a path parameter which specifies the
directory where the database resides.
sqlcode: -1031
sqlstate: 58031
which made me think: -
db2 list db directory
SQL1031N The database directory cannot be found on the indicated file
system.
Explanation:
The system database directory or local database directory could not be
found. A database has not been created or it was not cataloged
correctly.
The command cannot be processed.
User response:
Verify that the database is created with the correct path specification.
The Catalog Database command has a path parameter which specifies the
directory where the database resides.
sqlcode: -1031
sqlstate: 58031
which made me think: -
db2 list db directory
SQL1031N The database directory cannot be found on the indicated file system.
SQLSTATE=58031
SQLSTATE=58031
and then it hit me ….
I'd previously dropped the running container: -
cf ic stop db2
removed it: -
cf ic rm db2
and started a new one: -
cf ic run --name db2 -p 50000:50000 -e DB2INST1_PASSWORD=Qp455w0rd! -e LICENSE=accept -d registry.eu-gb.bluemix.net/david_hay/db2expressc:pamfixed db2start
and validated it: -
cf ic ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3cf533af-c95 registry.eu-gb.bluemix.net/david_hay/db2expressc:pamfixed "db2start " 50 seconds ago Running 50000/tcp db2
3cf533af-c95 registry.eu-gb.bluemix.net/david_hay/db2expressc:pamfixed "db2start " 50 seconds ago Running 50000/tcp db2
and requested an IP address: -
cf ic ip request
OK
IP address "54.23.128.93" was obtained.
IP address "54.23.128.93" was obtained.
and bound the IP address to the container: -
cf ic ip bind 54.23.128.93 db2
OK
The IP address was bound successfully.
OK
The IP address was bound successfully.
So, of course, I no longer had any databases :-)
To mitigate this, I started a shell to the running container: -
cf ic exec -i -t db2 /bin/bash
switched to the db2inst1 user: -
su - db2inst1
and created the SAMPLE database: -
db2sampl
Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Creating tables with XML columns and XML data in schema "DB2INST1"...
'db2sampl' processing complete.
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Creating tables with XML columns and XML data in schema "DB2INST1"...
'db2sampl' processing complete.
and validated that all was well: -
db2 connect to SAMPLE
Database Connection Information
Database server = DB2/LINUXX8664 10.5.5
SQL authorization ID = DB2INST1
Local database alias = SAMPLE
Database server = DB2/LINUXX8664 10.5.5
SQL authorization ID = DB2INST1
Local database alias = SAMPLE
db2 select "EMPNO,FIRSTNME,LASTNAME from DB2INST1.EMPLOYEE"
EMPNO FIRSTNME LASTNAME
------ ------------ ---------------
000010 CHRISTINE HAAS
000020 MICHAEL THOMPSON
000030 SALLY KWAN
000050 JOHN GEYER
000060 IRVING STERN
000070 EVA PULASKI
000090 EILEEN HENDERSON
000100 THEODORE SPENSER
000110 VINCENZO LUCCHESSI
000120 SEAN O'CONNELL
000130 DELORES QUINTANA
000140 HEATHER NICHOLLS
000150 BRUCE ADAMSON
000160 ELIZABETH PIANKA
000170 MASATOSHI YOSHIMURA
000180 MARILYN SCOUTTEN
000190 JAMES WALKER
000200 DAVID BROWN
000210 WILLIAM JONES
000220 JENNIFER LUTZ
000230 JAMES JEFFERSON
000240 SALVATORE MARINO
000250 DANIEL SMITH
000260 SYBIL JOHNSON
000270 MARIA PEREZ
000280 ETHEL SCHNEIDER
000290 JOHN PARKER
000300 PHILIP SMITH
000310 MAUDE SETRIGHT
000320 RAMLAL MEHTA
000330 WING LEE
000340 JASON GOUNOT
200010 DIAN HEMMINGER
200120 GREG ORLANDO
200140 KIM NATZ
200170 KIYOSHI YAMAMOTO
200220 REBA JOHN
200240 ROBERT MONTEVERDE
200280 EILEEN SCHWARTZ
200310 MICHELLE SPRINGER
200330 HELENA WONG
200340 ROY ALONZO
42 record(s) selected.
------ ------------ ---------------
000010 CHRISTINE HAAS
000020 MICHAEL THOMPSON
000030 SALLY KWAN
000050 JOHN GEYER
000060 IRVING STERN
000070 EVA PULASKI
000090 EILEEN HENDERSON
000100 THEODORE SPENSER
000110 VINCENZO LUCCHESSI
000120 SEAN O'CONNELL
000130 DELORES QUINTANA
000140 HEATHER NICHOLLS
000150 BRUCE ADAMSON
000160 ELIZABETH PIANKA
000170 MASATOSHI YOSHIMURA
000180 MARILYN SCOUTTEN
000190 JAMES WALKER
000200 DAVID BROWN
000210 WILLIAM JONES
000220 JENNIFER LUTZ
000230 JAMES JEFFERSON
000240 SALVATORE MARINO
000250 DANIEL SMITH
000260 SYBIL JOHNSON
000270 MARIA PEREZ
000280 ETHEL SCHNEIDER
000290 JOHN PARKER
000300 PHILIP SMITH
000310 MAUDE SETRIGHT
000320 RAMLAL MEHTA
000330 WING LEE
000340 JASON GOUNOT
200010 DIAN HEMMINGER
200120 GREG ORLANDO
200140 KIM NATZ
200170 KIYOSHI YAMAMOTO
200220 REBA JOHN
200240 ROBERT MONTEVERDE
200280 EILEEN SCHWARTZ
200310 MICHELLE SPRINGER
200330 HELENA WONG
200340 ROY ALONZO
42 record(s) selected.
I then re-ran my Java code: -
java -cp db2jcc4.jar:. JdbcTestDB2 54.23.128.93 50000 SAMPLE db2inst1 Qp455w0rd!
000010 CHRISTINE HAAS
000020 MICHAEL THOMPSON
000030 SALLY KWAN
000050 JOHN GEYER
000060 IRVING STERN
000070 EVA PULASKI
000090 EILEEN HENDERSON
000100 THEODORE SPENSER
000110 VINCENZO LUCCHESSI
000120 SEAN O'CONNELL
000130 DELORES QUINTANA
000140 HEATHER NICHOLLS
000150 BRUCE ADAMSON
000160 ELIZABETH PIANKA
000170 MASATOSHI YOSHIMURA
000180 MARILYN SCOUTTEN
000190 JAMES WALKER
000200 DAVID BROWN
000210 WILLIAM JONES
000220 JENNIFER LUTZ
000230 JAMES JEFFERSON
000240 SALVATORE MARINO
000250 DANIEL SMITH
000260 SYBIL JOHNSON
000270 MARIA PEREZ
000280 ETHEL SCHNEIDER
000290 JOHN PARKER
000300 PHILIP SMITH
000310 MAUDE SETRIGHT
000320 RAMLAL MEHTA
000330 WING LEE
000340 JASON GOUNOT
200010 DIAN HEMMINGER
200120 GREG ORLANDO
200140 KIM NATZ
200170 KIYOSHI YAMAMOTO
200220 REBA JOHN
200240 ROBERT MONTEVERDE
200280 EILEEN SCHWARTZ
200310 MICHELLE SPRINGER
200330 HELENA WONG
200340 ROY ALONZO
000020 MICHAEL THOMPSON
000030 SALLY KWAN
000050 JOHN GEYER
000060 IRVING STERN
000070 EVA PULASKI
000090 EILEEN HENDERSON
000100 THEODORE SPENSER
000110 VINCENZO LUCCHESSI
000120 SEAN O'CONNELL
000130 DELORES QUINTANA
000140 HEATHER NICHOLLS
000150 BRUCE ADAMSON
000160 ELIZABETH PIANKA
000170 MASATOSHI YOSHIMURA
000180 MARILYN SCOUTTEN
000190 JAMES WALKER
000200 DAVID BROWN
000210 WILLIAM JONES
000220 JENNIFER LUTZ
000230 JAMES JEFFERSON
000240 SALVATORE MARINO
000250 DANIEL SMITH
000260 SYBIL JOHNSON
000270 MARIA PEREZ
000280 ETHEL SCHNEIDER
000290 JOHN PARKER
000300 PHILIP SMITH
000310 MAUDE SETRIGHT
000320 RAMLAL MEHTA
000330 WING LEE
000340 JASON GOUNOT
200010 DIAN HEMMINGER
200120 GREG ORLANDO
200140 KIM NATZ
200170 KIYOSHI YAMAMOTO
200220 REBA JOHN
200240 ROBERT MONTEVERDE
200280 EILEEN SCHWARTZ
200310 MICHELLE SPRINGER
200330 HELENA WONG
200340 ROY ALONZO
So that's all good then :-)
The moral of the story - when you drop and recreate a container, don't assume that the "local" storage is still there; next time around, I'll mount some external storage to my container ….
Subscribe to:
Posts (Atom)
Note to self - Firefox and local connections
Whilst trying to hit my NAS from Firefox on my Mac, I kept seeing errors such as:- Unable to connect Firefox can’t establish a connection t...

-
Error "ldap_sasl_interactive_bind_s: Unknown authentication method (-6)" on a LDAPSearch command ...Whilst building my mega Connections / Domino / Portal / Quickr / Sametime / WCM environment recently, I was using the LDAPSearch command tha...
-
Another long story cut short, but I saw this: - curl: (58) unable to set private key file: 'dave.pem' type PEM from my Ansible...
-
Why oh why do I forget this ? Running this command : - ldapsearch -h ad2012.uk.ibm.com -p 389 -D CN=bpmbind,CN=Users,DC=uk,DC=ibm,DC=com -w...