Install / build docker squash on OS X to reduce docker image size

Recently while I was trying to install a Docker related app called docker-squash on OSX El Capitan.

For those who are not familiar with the utility; docker squash is a nice utility that reduces the size of docker images by removing the layers

However when running the command

go get github.com/docker/docker/pkg/units

I was getting the following error message :


Building docker-squash
export.go:19:2: cannot find package "github.com/docker/docker/pkg/units" in any of:
        /usr/lib/go/src/pkg/github.com/docker/docker/pkg/units (from $GOROOT)
        /root/t/docker-squash/src/github.com/docker/docker/p

Below I will show you how to build docker squash step by step (some steps can be omitted i.e. installing go if you already have installed)

Install go and set-up variables

brew install go
mkdir $HOME/.go
export GOPATH=$HOME/.go
export PATH=$PATH:$GOPATH/bin

Clone the docker squash repo

I'm not sure this is required but clone the repo under ~/.go/src/github.com/jwilder/docker-squash/

git clone https://github.com/jwilder/docker-squash.git

Install glock and sync your repo

under the folder ~/.go/src/github.com/jwilder/docker-squash/ run the following command

go get github.com/robfig/glock

Once the command finished sync your local repo with glock

glock sync github.com/jwilder/docker-squash

Install the units package

go get github.com/docker/docker/pkg/units

Build docker squash

GOBIN=$(pwd) make

Install gnu-tar and added to the path

brew install gnu-tar
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"

Move the executable to a bin folder

You should now have a docker-squash executable in your local repository; move the executable to a bin folder of your choice for example /usr/local/bin/

You should now be able to run docker-squash from your mac

Final thoughts and remarks

If you use docker-squash frequently you should change your .bashrc to do this automatically

Jaspersoft Studio OSX jdk 8/7 not starting

Recently I downloaded Jaspersoft studio on my Mac OSX but I was having trouble laughing the app as the system kept telling me I needed the older runtime version of Java, as you can see from the screenshot below (sorry in french)

Luckily this is solved pretty easy head up to your Applications folder and right click on Jaspersoft Studio.app then on the pop-up menu show package contents then inside the Contents folder you should find an info.plist file; edit the file and add the following line (or change the Current in the path with the JDK version you want) :

-vm/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

Save the edited file; you should now be able to launch the software without problems