Docker UCLUG 5/13/2014

Awesome meeting last night with my fellow geeks at UCLUG  – Many Thanks to Tim Fowler –

The topic was Docker … Docker is based on the concept of containers .. no necessarily the LXE containers (akin to Solaris zones), although the docker containers will run within LXE containers, basically docker is described as chroot on steroids.

The minimum basis for a docker container is the bare minimum libraries required to run a Linux distribution (probably version close to a net install).  So I downloaded the base fedora docker image – about 250 MB … it booted up in docker in about 3 seconds.

Screenshot - 05142014 - 06:41:13 PM

The idea is that you start with one of these base images, yum install all required packages to run your app.  For example, for a simple wordpress website container, you may install apache, php, mysql.  You do a docker commit to save your changes.   The changes get saved as a separate layer.  

So my understanding of the internals of docker is that when you boot a docker image, the base image plus all layers get joined together via unionfs, and then the linux system invokes a chroot to that unionfs mount and invokes the normal system startup as if it was a stand alone machine.  Almost a virtual machine, but it does not run a separate kernel.  Essentially you can pull down  the base ubuntu image and run Ubuntu linux on top of Fedora.  In addition, there are settings that control CPU/Memory affinity for each container as well as some SDN (software defined networking) components that allow you to control how one container can communicate with other containers and/or back to/from the host machine.  So you can expose port 80/443 running in a container to the host machine (and out to the network)

Unlike a virtual machine where you may want to duplicate a base “machine” to use it as the basis for several different applications, you can build several docker containers, all with their own unique purposes, based on the same fedora base image.


Unlike a virtual machine clone where you are duplicating the total OS, with docker, CONTAINER_A and CONTAINER_B  (as well as all other containers built off the same base image) all reference back to the same base fedora image and then just apply their own individual layers representing the deltas.

That’s it in a nutshell

Turning your Nook Color into an Android 4.1 Jellybean tablet

Converting a nook color into a Jellybean 4.1 tablet.  I think it took me longer to write this up than to actually do it 🙂

Done on Linux Mint – bash commands are showing in bold italics

  1. grab a microsd card – they say that Sandisk brand, at least Class 4 works best.
    I have done this with both a 4GB and 8GB card, both worked, you can go larger – I am not sure if there is a max capacity supported by Android or the nook
  2. Download the boot image –
    Look for the attachment to the main article –
    I get a md5sum of : a2f15e48a5bb858db8ec02ccedbcb5b7
  3. [email protected]:~$ mkdir nook
  4. [email protected]:~/nook$ wget  
  5. [email protected]:~/nook$ wget
  6. [email protected]:~/nook$ md5sum cm*.zip gapp*.zip
  7. [email protected]:~/nook$ unzip
      inflating: generic-sdcard-v1.3-CM7-9-10-larger-Rev5.img
  8. [email protected]:~/nook$ sudo dd if=generic-sdcard-v1.3-CM7-9-10-larger-Rev5.img of=/dev/sde bs=1M
    [sudo] password for glaw: 
    298+1 records in
    298+1 records out
    312560640 bytes (313 MB) copied, 69.6386 s, 4.5 MB/s
  9. eject the card and reinsert – I just disconnected my card reader and reconnected
  10. Mount the cd card – this is a 300 mb vfat parition

    [email protected]:~/nook$ sudo mount /dev/sde1 /mnt
    [email protected]:~/nook$ls -la /mnt

    total 8112
    drwxr-xr-x  2 root root    4096 Dec 31  1969 .
    drwxr-xr-x 27 root root    4096 Jan 18 00:13 ..
    -rwxr-xr-x  1 root root   14504 Feb 15  2011 MLO
    -rwxr-xr-x  1 root root  289328 May 29  2011 u-boot.bin
    -rwxr-xr-x  1 root root 2756116 May 14  2011 uImage
    -rwxr-xr-x  1 root root 5234466 Oct 17 19:41 uRamdisk
  11. [email protected]:~/nook$ sudo cp cm*.zip gapp*.zip /mnt
    [email protected]:~/nook$ls -la /mnt

    total 253116
    drwxr-xr-x  2 root root      4096 Dec 31  1969 .
    drwxr-xr-x 27 root root      4096 Jan 18 00:13 ..
    -rwxr-xr-x  1 root root 158172246 Jan 19 10:14
    -rwxr-xr-x  1 root root  92706064 Jan 19 10:15
    -rwxr-xr-x  1 root root     14504 Feb 15  2011 MLO
    -rwxr-xr-x  1 root root    289328 May 29  2011 u-boot.bin
    -rwxr-xr-x  1 root root   2756116 May 14  2011 uImage
    -rwxr-xr-x  1 root root   5234466 Oct 17 19:41 uRamdisk
  12. [email protected]:~/nook$ sudo umount /mnt
  13. eject the card,
  14. With the nook powered off, insert into the nook’s microsd slot and then power on.  Sit back and relax for 4 and a half minutes :
  15. repower on the nook and welcome to Android Jellybean.


WordPress – importing images from non-wordpress images directory

Working on a freelance site and somehow a bunch of images got uploaded to /images/2012/09/…  what the heck? I cannot even figure out how that happened.

Trying this new “” plugin and guess what, it only works off images inside the media manager.

After looking around for a couple hours, I finally figured it all out.  DISCLAIMER:  Before trying this, make sure you back up your database.  PHPMyAdmin has an “Export” option that will let you do this.

  1. First is a plug-in called “add from server” –  This plugin gives you a file manager type interface to browser your website directories, so I pointed it at /images and let it import from there.  I wish it was recursive, but no such luck.  Lucky for me, I only had to drill down into /images/2012/09/ and import from there as well as my top level /images directory.  Importing gives you the option of using the original file date, so it copies the files to /wp-content/uploads/2012/09 and maintains that same date based hierarchy.  From the /images directory I just imported those ones with today’s date, so they ended up in /wp-content/uploads/2013/01/…
  2. After importing I had to refresh some of my MySQL skills.  The trick was to search the database for src=”/images/…” and update that to be src=”/wp-content/uploads/…”.  It took me a couple tries to get it right.  I started with a SELECT statement to get the syntax correct.
    SELECT post_content,replace(post_content,’src=”/images’,’src=”/wp-content/uploads’) FROM `wp_posts` WHERE post_content like ‘%src=”/images%’;
    This let me verify the substitution was happening the way I wanted it to, then it was just a matter of rewrite this as an UPDATE query (after I BACKED UP MY DATABASE!), this was the query:update wp_posts set post_content=replace(post_content,’src=”/images’,’src=”/wp-content/uploads’)  WHERE post_content like ‘%src=”/images%’;


Linux Mint Maya with Cinnamon 1.6 – Add additional media apps to the sound applet

I am a recent convert over to Linux Mint from Mac OSX.  After running OSX on my converted windows PC for 4 years, I got tired of not being able to update it so I figured I would take another run at Linux on the Desktop.

Linux Mint ships with their “cinnamon” desktop, which is a modified version of Gnome3.  After updating to the latest release of Cinnamon (1.6), I have been tweaking the GUI.  One of the “panel” applets Mint ships with is the Volume control applet, which also lets you launch different system media players.  Mint seems to ship with the basic media apps and uses Banshee as its default MP3 player.  

My primary media apps are Pandora and Songbird at the moment.  I am a paid Pandora user, so they give you access to their “desktop app” which runs via Adobe Air.  Here is a little tutorial on adding these 2 apps to the “Launch” area of the sound applet.  

First, you can install Sondbird using : sudo apt-get install songbird 

Pandora is a little more difficult, see this link on Installing Adobe Air – once this is installed, you can double click on the Pandora.air file and it should install properly.  

Adding these to the sound applet requires editing the javascript file that drives the applet, this is located at /usr/share/cinnamon/applets/[email protected]  In a terminal window,  

First we need to figure out the name of the pandora launcher file, which I believe gets set up with a unique id for each user.  

cd /usr/share/applications

[email protected] : /usr/share/applications $ ls com.pandora*


cd /usr/share/cinnamon/applets/[email protected]

sudo cp applet.js applet.js.orig 
sudo vi applet.js

Look for the line:

let compatible_players = [ “clementine”, “mpd”, “exaile”, “banshee”, “rhythmbox”, “rhythmbox3”, “pragha”, “quodlibet”, “guayadeque”, “amarok”, “googlemusicframe”, “xbmc”, “xnoise”, “gmusicbrowser”, “spotify”, “audacious”, “vlc”, “beatbox” ]

and update it to look like this:

let compatible_players = [ “clementine”, “mpd”, “exaile”, “banshee”, “rhythmbox”, “rhythmbox3”, “pragha”, “quodlibet”, “guayadeque”, “amarok”, “googlemusicframe”, “xbmc”, “xnoise”, “gmusicbrowser”, “spotify”, “audacious”, “vlc”, “beatbox” , “songbird” , “com.pandora.desktop.fb9956fd96e03239939108614098ad95535ee674.1” ];

It looks like since the default launcher for songbird is simply called songbird.desktop, we do not need any special value here, but substitute your unique pandora launcher file name (minus the .desktop) above.  
Save the file, and then logout or resart Cinnamon.  You should have Pandora and Songbird on the sound applet menu now 🙂

WordPress – using short codes within 404 page

Just a trick I just figured out – I installed a sitemap plugin for wordpress and wanted to drop the rendered sitemap into my 404 page.  The short code for the plug was [ slick-sitemap ].  So, in my 404.php page within my theme directory, I just added this :

<?php echo  apply_filters(‘the_content’,'[slick-sitemap]’);?>


that’s, well, slick 🙂


My top 5 wordpress plugins

404 Redirected – coupled with SEO Ultimate, allows you to catch 404 errors (ie – outdated bookmarks) and link them to the correct content.

Akismet – comes bundled with wordpress and for good reason.  Best anti-spam tool I have found for wordpress.

Better WordPress Minify  – awesome at reducing the number of HTTP requests your site generates.  combines all JS into 1 <javascript> tag, and all css into a single tag.

Contact Form 7 – simple contact form to email processing plugin

 SEO Ultimate – This one is helpful, not just for SEO but for general site management.  Has a 404 tracker as well as allows you to defined per page custom titles, meta descriptions, and keywords.


Midori Browser – Moving the New Tab button

I am running the Midori browser inside of Cygwin-X at work.  This allows me to browse and download within Cygwin easier, as well as bypass some of the security imposed on the network at work.

One thing I have found that I absolutely hate is the order Midori puts its task buttons in.  The first button on EVERY other browser is Back – Midori uses “New Tab”  – WTF?!  I find myself clicking “New Tab” meaning to go back.  This has got to go!

I found that the easy fix for this is by editing the configuration file.  On Cygwin this file is located in .config/midori/config

Make sure you exit out of Midori, then open the config file in vi.  The line to look for is toolbar-items=.  I moved TabNew from the first entry to the last.  Saved the file and then restarted Midori.


Upgrade your ESXi vmtool isos

Need to update the vmtools in your ESXI 4.0 server?

You can download the ESXI 4.1 ISO updates free from VMware. Log in/Register at and then look for “VMware Tools CD image for Linux Guest OSes” and download the ISO image.

You will have need to enabled SSH on your ESXi host before this – as well have enough disk space to accomodate this file. The new linux.iso is more then 2X the old and I had to pull all of the unused iso’s (linux.iso, freebsd.iso, netware.iso, solaris.iso, and winPre2k.iso) off my ESXi host to make room.

Once I have replaced linux.iso with the new file, a new file signature also needs to be generated.

I did not find the original private key this was signed with, but its easy to generate a new private/public key pair and resign all iso’s if needed.

You will find the iso images in the following directory:


Using openssl you can generate the private key:

openssl genrsa -out tools-priv.pem 2048

using the private key you just generated, we can now recreate the that ESXi verfies the iso images against:

openssl rsa -in tools-priv.pem -pubout -out

Now we can recreate the linux.iso.sig

openssl dgst -sha1 -sign tools-priv.pem < linux.iso > linux.iso.sig

Now you should be able to install/upgrade all of your Vmtool’s with this latest and greatest version.