Testing Docker on the IBM Power Development Cloud
By John Jacobson, IBM Cloud Technical Specialist
There have been a few other blog posts written about Docker on Power (see references at the end of this article) so while this is not the first article written about this topic, this is my account of leveraging the IBM Power Development Cloud (PDP) to test and gain familiarity with this container technology on IBM Power Systems....for free.
The Virtual Server Request
The PDP currently provides Virtual Server access for Power Systems. This is not a Container as a Service like they offer in Bluemix. However, this does not mean you cannot request a virtual server and get Docker running yourself.
To request Virtual Server access on the PDP, follow the easy steps in the Create reservation user guide https://public.dhe.ibm.com/partnerworld/pub/pdp/create_pdp_reservation_guide.pdf
When making your request, be sure to specify the 'Ubuntu Linux' as the Image category and 'Docker on Ubuntu 16.04' under Select an image.

Once the reservation is available, you can run a few commands to see that docker is installed
$ sudo docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2 gccgo (Ubuntu 5.1~rc1-0ubuntu1.1) 5.0.1 20150414 (prerelease) [gcc-5-branch revision 222102]
Git commit (client): 7c8fca2
OS/Arch (client): linux/ppc64le
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.4.2 gccgo (Ubuntu 5.1~rc1-0ubuntu1.1) 5.0.1 20150414 (prerelease) [gcc-5-branch revision 222102]
Git commit (server): 7c8fca2
OS/Arch (server): linux/ppc64le
$ sudo dpkg -l docker.io
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============-============-============-===================================
ii docker.io 1.6.2~dfsg1- ppc64el Linux container runtime
Check to see if if the docker service is started
$ sudo service docker status
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2015-06-11 10:05:14 EDT; 15min ago
Docs: http://docs.docker.com
Main PID: 2850 (docker)
CGroup: /system.slice/docker.service
└─2850 /usr/bin/docker -d -H fd://
Jun 11 10:05:27 sys-5920 docker[2850]: time="2015-06-11T10:05:27-04:00" lev...)"
Jun 11 10:05:27 sys-5920 docker[2850]: time="2015-06-11T10:05:27-04:00" lev...)"
Jun 11 10:08:08 sys-5920 docker[2850]: time="2015-06-11T10:08:08-04:00" lev...0"
Jun 11 10:08:08 sys-5920 docker[2850]: time="2015-06-11T10:08:08-04:00" lev...)"
Jun 11 10:08:23 sys-5920 docker[2850]: time="2015-06-11T10:08:23-04:00" lev...)"
Jun 11 10:08:23 sys-5920 docker[2850]: time="2015-06-11T10:08:23-04:00" lev...)"
Jun 11 10:08:23 sys-5920 docker[2850]: time="2015-06-11T10:08:23-04:00" lev...)"
Jun 11 10:11:33 sys-5920 docker[2850]: time="2015-06-11T10:11:33-04:00" lev...n"
Jun 11 10:11:33 sys-5920 docker[2850]: time="2015-06-11T10:11:33-04:00" lev...)"
Jun 11 10:11:33 sys-5920 docker[2850]: time="2015-06-11T10:11:33-04:00" lev...)"
Hint: Some lines were ellipsized, use -l to show in full.
If docker is not started issue the following command and check the status again
$ sudo service docker start
$ sudo service docker status
The Docker installation creates a local private network on the virtual server instance. This means by default you won't be able to access your containers unless you expose the particular port. I found a couple different ways to do this. One using the Dockerfile (EXPOSE) as well as deploying the container with -p PORT:PORT. There is an example of this further down in this article.
$ ifconfig
docker0 Link encap:Ethernet HWaddr 56:84:7a:fe:97:99
inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::5484:7aff:fefe:9799/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:536 (536.0 B) TX bytes:648 (648.0 B)
eth0 Link encap:Ethernet HWaddr 52:54:00:8c:6a:18
inet addr:xxx.xx.xxx.xxx Bcast:172.29.191.255 Mask:255.255.192.0
inet6 addr: fe80::5054:ff:fe8c:6a18/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:643277 errors:0 dropped:42 overruns:0 frame:0
TX packets:4299 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:65062365 (65.0 MB) TX bytes:332827 (332.8 KB)
Interrupt:19
If you did not request the Docker image above or you are testing in your own environment here are the steps to install Docker...
Installing docker
Looking at various blogs, there are multiple methods to install docker.
Method 1
$ wget ftp://ftp.unicamp.br/pub/linuxpatch/docker-ppc64/ubuntu/14_10/docker.io-1.4.1-dev_ppc64el.deb
$ sudo dpkg -i docker.io-1.4.1-dev_ppc64el.deb
Method 2
$ sudo echo deb http://ftp.unicamp.br/pub/ppc64el/ubuntu/14_10/docker-ppc64el/ utopic main >> /etc/apt/sources.list
$ sudo apt-get update
$ sudo apt-get install docker.io
Method 3
NOTE: As of Ubuntu 15.04 Vivid Vervet, Docker version 1.5 is included. Therefore the apt repository ftp.unicamp.br is not required.
$ sudo apt-get update
$ sudo apt-get install docker.io
Check the the installation and status of the docker status using the commands that were previously covered.
Create and Run your own initial base image
There are a couple different methods to get a base image up and running. I tested only the first one as it seemed to be the easiest to get things up and running.
Method 1
$ wget http://cdimage.ubuntu.com/ubuntu-core/releases/14.10/release/ubuntu-core-14.10-core-ppc64el.tar.gz
$ cat ubuntu-core-14.10-core-ppc64el.tar.gz | sudo docker import - ubuntucore-ppc64le
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntucore-ppc64le latest c2511a3aafad 3 minutes ago 206.5 MB
NOTE: Other ubuntu-core images can be found here ubuntu-core images can be found here http://cdimage.ubuntu.com/ubuntu-core/
Method 2
Since I didn't test Method 2, I don't have any notes to share. If you want to try it, its described in Step 2 here https://www.ibm.com/developerworks/library/d-docker-on-power-linux-platform/
Run image
Once I had the image created, I issued the following command to run it. This created the container and allows an interactive shell.
$ sudo docker run -t -i ubuntucore-ppc64le:latest /bin/bash
NOTE: flags -i interactive -t allocate pseudo tty
Tag image
Container Images can be tagged with a label to help identify it. Tags are typically used to specify versioning.
$ sudo docker tag c2511a3aafad ubuntucore-ppc64le:14.10
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntucore-ppc64le 14.10 c2511a3aafad 3 minutes ago 206.5 MB
ubuntucore-ppc64le latest c2511a3aafad 3 minutes ago 206.5 MB
Run Registry images
One of the features of Docker is the portability of images. Docker hub and private registries are services that enable the sharing of images. So I went to http://hub.docker.com, clicked on Browse & Search and entered 'ppc64le'. This returned a number of images, so I thought I would download and test.
NOTE: At the time of writing, docker hub does not recognize whether images have been created for x86 or ppc6l4. Therefore, it is recommended to append ppc64le architecture to the name with either _ppc64le or -ppc64le. Multi-architecture container registry is something that is being looked into.
Here's a list of what I found!
https://registry.hub.docker.com/u/schabrolles/odoo_psql_ppc64le/
https://registry.hub.docker.com/u/schabrolles/nagios_ppc64le/
https://hub.docker.com/u/schabrolles/elasticsearch_ppc64le/
https://registry.hub.docker.com/u/schabrolles/memcached_ppc64le/
https://registry.hub.docker.com/u/schabrolles/postgresql_ppc64le/
https://registry.hub.docker.com/u/schabrolles/odoo_ppc64le/
Pull and run image
To test pulling and running an existing registry image, issue the following commands
$ sudo docker pull schabrolles/odoo_psql_ppc64le
$ sudo docker run -d -p 8069:8069 schabrolles/odoo_psql_ppc64le
To see that the container is running issue the command
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5a6bedd9f261 schabrolles/odoo_psql_ppc64le:8.0 "/bin/bash /start_al 26 seconds ago Up 18 seconds 8072/tcp, 0.0.0.0:8069->8069/tcp lonely_galileo
We can see port 8069 is mapped/exported to the docker host IP:port so you can visit http://<IP_ADDRESS_OF_VIRTUAL_SERVER_RESERVATION>:8069
Create and run your own Container Image (Dockerize)
So we've seen how an existing container image was pulled from the registry so let's look at how a container image is built. Container images are built using a Dockerfile. More details on Dockerfile can be found here https://docs.docker.com/reference/builder/
MongoDB example
On the Virtual Server issue the following commands
$ mkdir -p ~/dockerize/mongodb
$ cd ~/dockerize/monogdb
$ touch Dockerfile
Then add the following to the Dockerfile
***************************START EXAMPLE*********************************
# Dockerizing MongoDB: Dockerfile for building MongoDB images
# Based on ubuntucore-ppc64le:14.10, installs MongoDB following the instructions from:
# http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
FROM ubuntucore-ppc64le:14.10
MAINTAINER John Jacobson jjacobso@us.ibm.com
RUN echo "deb http://ports.ubuntu.com/ubuntu-ports/ utopic universe" | tee /etc/apt/sources.list.d/ubuntu-utopic.list && \
echo "deb http://ports.ubuntu.com/ubuntu-ports/ utopic-updates universe" | tee /etc/apt/sources.list.d/ubuntu-utopic-updates.list && \
sudo apt-get update && \\
sudo apt-get install -y mongodb-server && \
mkdir -p /data/db
EXPOSE 27017
ENTRYPOINT /usr/bin/mongod
***************************END EXAMPLE*********************************
NOTE: Consider the use of $(lsb_release -sc) instead of hardcoding the ubuntu release name. This allows portability of your Dockerfile across different versions of the Distro.
i.e. RUN echo "deb http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -sc) universe" | tee /etc/apt/sources.list.d/ubuntu-$(lsb_release -sc).list
Build the container
To build the container, issue the following command from the directory ~/dockerize/monogdb
$ sudo docker build -t mongodb-ppc64:latest .
Sending build context to Docker daemon 2.56 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntucore-ppc64le:14.04.2
---> f2b501c5fe32
Step 1 : MAINTAINER John Jacobson jjacobso@us.ibm.com
---> Running in 8aeccd881a7d
---> c50098f52011
Removing intermediate container 8aeccd881a7d
Step 2 : RUN echo 'deb http://ports.ubuntu.com/ubuntu-ports/ utopic universe' | tee /etc/apt/sources.list.d/ubuntu-utopic.list && echo 'deb http://ports.ubuntu.com/ubuntu-ports/ utopic-updates universe' | tee /etc/apt/sources.list.d/ubuntu-utopic-updates.list && sudo apt-get update && apt-get install -y mongodb-server && mkdir -p /data/db
---> Running in f13230ac83bd
---> b40098f62012
deb http://ports.ubuntu.com/ubuntu-ports/ utopic universe
deb http://ports.ubuntu.com/ubuntu-ports/ utopic-updates universe
..................................
..................................
paring to unpack .../libpcap0.8_1.6.2-1_ppc64el.deb ...
Unpacking libpcap0.8:ppc64el (1.6.2-1) ...
Selecting previously unselected package libboost-system1.55.0:ppc64el.
Preparing to unpack .../libboost-system1.55.0_1.55.0+dfsg-1ubuntu3_ppc64el.deb ...
..................................
..................................
Setting up mongodb-clients (1:2.6.3-0ubuntu5) ...
Setting up mongodb-server (1:2.6.3-0ubuntu5) ...
Adding system user `mongodb' (UID 101) ...
Adding new user `mongodb' (UID 101) with group `nogroup' ...
Not creating home directory `/var/lib/mongodb'.
Adding group `mongodb' (GID 104) ...
Done.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
* Starting database mongodb
...done.
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mongodb (1:2.6.3-0ubuntu5) ...
Processing triggers for libc-bin (2.19-10ubuntu2) ...
Step 3 : EXPOSE 27017
---> Running in 90b960218f64
---> 80f9985257d3
Removing intermediate container 90b960218f64
Step 4 : ENTRYPOINT usr/bin/mongod
---> Running in 68ec19b81fd7
---> c608a51dc0ce
Removing intermediate container 68ec19b81fd7
Successfully built c608a51dc0ce
Some of the bulid steps have been omitted but in the end you should see a message indicating that the container was successfully built
List new container image
To see our new container image issue the following command
$ sudo docker images | grep mongodb
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mongodb-ppc64le latest c608a51dc0ce About a minute ago 601 MB
NOTE: We use grep as to filter our the list of images to just ones containing mongodb
Run the container
To run the newly created mongodb container, issue the following command
$ sudo docker run mongodb-ppc64le
usr/bin/mongod --help for help and startup options
2015-04-28T19:42:12.990+0000 [initandlisten] MongoDB starting : pid=6 port=27017 dbpath=/data/db 64-bit host=d0f197663b4b
2015-04-28T19:42:12.990+0000 [initandlisten] db version v2.6.3
2015-04-28T19:42:12.990+0000 [initandlisten] git version: nogitversion
2015-04-28T19:42:12.990+0000 [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2015-04-28T19:42:12.990+0000 [initandlisten] build info: Linux fisher02 3.13.0-16-generic #36-Ubuntu SMP Tue Mar 4 23:03:28 UTC 2014 ppc64le BOOST_LIB_VERSION=1_55
2015-04-28T19:42:12.990+0000 [initandlisten] allocator: tcmalloc
2015-04-28T19:42:12.990+0000 [initandlisten] options: {}
2015-04-28T19:42:13.658+0000 [initandlisten] journal dir=/data/db/journal
Additional Container Tasks
Remove image
To remove an image, issue the following command
$ sudo docker rmi <image id or name>
NOTE: You may have an issue removing an image if you deployed a container. Even if the container is no longer running, you will get this error. You need to remove the container first OR use -f i.e. $ sudo docker rmi -f
Remove Container
To remove a container, issue the following command
$ sudo docker rm <container id or name>
Push a container image to a Repository
So once I had my mongodb container image, I thought I would try pushing it to Docker hub. However, when I tried to push it, I got a message about buffering to disk and then it failed. This was with version 1.4.1. Interestingly enough, I was able to push images with the prior version of 1.3.0 (but this is pretty old). Instead I created my own local registry to test the push capability. I used the local registry setup instructions documented in Step 3 here https://www.ibm.com/developerworks/library/d-docker-on-power-linux-platform/
Once my local registry was setup, I was then able to proceed to pushing my image
First you need to tag your current local image appropriately
$ sudo docker tag c608a51dc0ce localhost:5000/mongodb-ppc64le
Then you can push
$ sudo docker push localhost:5000/mongodb-ppc64le
The push refers to a repository [localhost:5000/mongodb-ppc64le] (len: 1)
Sending image list
Pushing repository localhost:5000/mongodb-ppc64le (1 tags)
37d0bddf58b7: Image successfully pushed
81a302d03eb4: Image successfully pushed
04b0cc0d2d0b: Image successfully pushed
337d5cf678b3: Image successfully pushed
ff0427eeaba6: Image successfully pushed
ee691e26e785: Image successfully pushed
80f9985257d3: Image successfully pushed
c608a51dc0ce: Image successfully pushed
Pushing tag for rev [c608a51dc0ce] on {http://localhost:5000/v1/repositories/mongodb-ppc64le/tags/latest}
$ sudo docker images | grep mongodb
localhost:5000/mongodb-ppc64le latest c608a51dc0ce 56 minutes ago 601 MB
mongodb-ppc64le latest c608a51dc0ce 56 minutes ago 601 MB
Remove all exited containers
$ sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm
References
https://www.ibm.com/developerworks/community/blogs/fe313521-2e95-46f2-817d-44a4f27eba32/entry/docker_on_ubuntu_vivid_vervet_for_power_le?lang=en
https://www.ibm.com/developerworks/library/d-docker-on-power-linux-platform/
https://www.ibm.com/developerworks/community/blogs/fe313521-2e95-46f2-817d-44a4f27eba32/entry/ubuntu_core_on_docker_for_power?lang=en
https://docs.docker.com/userguide/
https://docs.docker.com/articles/basics/