With z/OS 2.4 you can now run Docker containers in zCX address spaces. I won’t get into the whys and wherefores of Docker and zCX, except to say that it allows you to run many packages that are available on a wide range of platforms.
This post, funnily enough, is about running Docker on a couple of reasonably widely available platforms. And why you might want to do so – before running it in zCX address spaces on z/OS.
Why Run Docker Elsewhere Before zCX?
This wouldn’t be a permanent state of affairs but I would install Docker and run it on a handy local machine first.
This is for two reasons:
- To get familiar with operating Docker and installing packages.
- To get familiar with how these packages behave.
As I’ll show you – with two separate environments – it’s pretty easy to do.
The two environments I’ve done it on are
- Raspberry Pi
- Mac OS
I have no access to Windows – and haven’t for over 10 years. I’d hope (all snark aside) it was as simple as the two I have tried.
One other point: As the Redbook exemplifies, not all the operational aspects of zCX are going to be the same, but understanding the Docker side is a very good start.
Raspberry Pi / Linux
Raspberry Pi runs a derivative of Debian. I can’t speak for other Linuxes. But on Raspberry Pi it’s extremely easy to install Docker, so it will be for other Debian-based distributions. (I just have no experience of those.)
You simply issue the command:
apt-get install docker
If you do that you get a fully-fledged Docker set up. It might well pull in a few other packages.
My Raspberry Pi 4B has a 16GB microSD card and it hasn’t run out of space. Some docker packages (such as Jupyter Notebooks) pull in a few gigabytes so you probably want to be a little careful.
After you’ve installed Docker you can start installing and running other things. A simple one is Node.js or “node” for short.
A Simple Node Implementation
I created a small node test file with the nano editor:
And saved it as test.js.
I can run this with the following command:
docker run -v "$PWD":/usr/src/app -w /usr/src/app node test.js
This mounts the current working directory as the
/usr/src/app directory in Docker (
-v option of the
docker run command), sets the docker working directory to this directory (
-w option), and then invokes node to run test.js. The result is a write to the console.
(This combination of
-w is a very common idiom, so it’s worth learning it.)
Accessing A Raspberry Pi From iOS
Though I SSH into my Pi from my Mac the most fun is doing it from iOS. (Sorry if you’re an Android user but you’ll have to find your own SSH client as I have little experience of Android. Likewise Windows users. I’m sure you’ll cope.)
My Raspberry Pi is set up so that I use networking over Bluetooth or WiFi. This means I can play with it on a flight or at home. In both cases I address it as
Pi4.local, through the magic of Bonjour.
Specifically I can SSH into the Pi from an iOS device in one of two ways:
- Using the “Run Script over SSH” Shortcuts action.
- Using the Prompt iOS app.
I’ve done both. I’ve also used a third way to access files on the Pi: Secure ShellFish.
All these ways work nicely – whether you’re on WiFi or networking over BlueTooth.
For the Mac it’s a lot simpler. For a start you don’t need to SSH in.
I installed Docker by downloading from here. (I note there is a Windows image her but I haven’t tried it.)
Before it lets you download the .dmg file you’ll need to create a userid and sign in. Upon installation a cute Docker icon will appear in the menu bar. You can use this to control some aspects of Docker. You can sign in there.
From Terminal (or, in my case, iterm2) you can install nginx with:
docker pull nginx
This is a lightweight web server. You start it in Docker with:
docker run -p 8080:80 –d nginx
If you point your browser at
localhost:8080 you’ll get a nice welcome message. This writeup will take you from there.
There’s an excellent Redbook on zCX specifically: Getting started with z/OS Container Extensions and Docker
It’s also pretty good on other Docker environments, though it doesn’t mention them.
Which, I think, tells you something. Probably about portability and interoperability.
So, as I said, it’s easy and rewarding to play with Docker just before doing it on z/OS with zCX. And, as I said on Episode 25 of our podcast, I’d love to see SMF data from zCX.
If I get to see SMF data from a zCX situation – whether a benchmark or a real customer environment – I’ll share what I’m seeing. I already have thoughts.
And maybe I’ll write more about my Raspberry Pi setup some day.
One thought on “Dock It To Me”