Archive for the ‘Work’ Category

Adding a package to boot2docker

Friday, January 16th, 2015

Docker is seeing rapid adoption among the software development world. So far it seems to me a very nice way to make software installation much less painful, but there is still plenty of room for improvement.

If you’re running Linux then you can stop reading now. Docker is an abstraction layer over Linux Containers (LXC), they’ve also created a repository where pre-defined containers can be found – you can even add your own. LXC is cool stuff, but it does mean Docker runs Linux.

Windows and OSX users need to use boot2docker, a Tiny Core Linux virtual machine that has just enough stuff to run docker. This is a fine solution but often when people ask about missing tools inside of boot2docker, the answer is to install a container that has the tools you want and run inside of that container. Things quickly start to feel like Inception.

Boot2docker is based on Tiny Core Linux, so you can use the tce-load utility to install additional components if needed. So say we wanted to run Perl:

$ tce-load -wi perl5

You can sniff around the repository to figure out what packages are available.

There is documentation on adding a persistent partition to your boot2docker setup. This is useful if you want to run the tce-load every time you run without having to type it in each time. Getting this setup is a little bit fiddly, and if we’re clever we can do something a bit cooler.

Let’s build a custom boot2docker.iso file! The build process is nicely documented. We can use a Dockerfile to create our own iso with the packages we want.

Before we start, you will want to make sure that your boot2docker is running with enough resources. The default should be 2048MB which should work, you will also need enough disk space on /var/lib/docker/aufs inside boot2docker.  If you have problems consider changing your configuration.

Create a Dockerfile with the following contents:

FROM boot2docker/boot2docker

# Append indicator this is modified image
RUN echo "\nMy modified boot2docker.iso\n" >> $ROOTFS/etc/motd

# Install perl5
RUN curl -L -o /tmp/perl5.tcz $TCL_REPO_BASE/tcz/perl5.tcz && \
unsquashfs -f -d $ROOTFS /tmp/perl5.tcz && \
rm -rf /tmp/perl5.tcz

# build the iso
RUN /make_iso.sh
CMD ["cat", "boot2docker.iso"]

Then follow the boot2docker.iso build process.

$ sudo docker build -t my-boot2docker-img .
$ sudo docker run --rm my-boot2docker-img > boot2docker.iso

The FROM is used to declare the base image we want to start from. We’re building our new container on this base.

The RUN directive is executed against the current image at build time. In this case we can’t use tce-load since we’re not actually running Tiny Core Linux at this point, we’re running against the docker image we are building. This is why we’re doing the installation of perl manually. I based the installation from the boot2docker DockerFile.

The last two steps “build the iso” are lifted directly from the same boot2docker Dockerfile, these are the steps required to actually create the iso file.

Figuring out how to run the boot2docker.iso I’ll leave as an exercise for the reader.

Thoughts on Cloud

Wednesday, July 18th, 2012

I’ve started to contribute to an IBM blog: Thoughts on Cloud. My first post is up today on the topic of using the Java API to access IBM SmartCloud Enterprise.

I still have plenty of personal projects on the go that I’ll blog about here, just been enjoying the nice weather and not sitting in front of the computer while I’m at home.

Self Promotion: Web Video Interview

Tuesday, May 31st, 2011

As part of a Java Technology India Group event called “Java week 2011″ – I was asked to participate in an interview with the experts series. The resulting video interview is linked above. If you want to see a bit more about the entire event, check out the main page.

I need to thank my co-worker Lee for bringing in his camera and also asking the questions on the video.  We did it late on a Friday in one take, so it is very casual.

Here is the list of questions asked:

  • Q. Thank you for granting us this interview. Please introduce yourself and let us know a little about your background and the work you are currently involved in.
  • Q. What has impressed you in monitoring developments in Java technology?
  • Q. What is IBM’s stake and investment in Java Technologies ?
  • Q. What are the technology focus areas for IBM in Java?
  • Q. Do you see any challenges with Java scaling up in leveraging multi-core systems ?
  • Q. While Java (and the JVM) approaches memory management as an internal matter, there are efforts towards moving parts of memory outside Java heap – for instance, look at GigaSpaces, Terracota (and their eCache) etc. What are your thoughts on how this is going to shape up? More specifically, will the Garbage Collection technology become optimal for specific use-cases like caching for instance?
  • Q.  Lately, there is an appliance based delivery of Java (Azul). That approach has compelling technical claims – be it ‘pauseless garbage collection’ or the simplicity in attaining elasticity (Zing). Can you compare and contrast in terms of the overall cost, usability and scalabilty of IBM’s approach versus the appliance based approach?
  • Q.  Any advice for our readers and young developers who aspire to pursue their career in Java ?

My favorite part of the interview is at the 10min mark, where the final question is asked.  If you manage to make it through all 11:20 of the video and feel I didn’t give enough of answer to any of the questions, feel free to comment and I’ll reply with expanded detail.