Docker on Google Compute Engine – a Hello World with OpenCV

Docker seems to strike a great middle-ground between complete-but-full-blown VM’s (a la VirtualBox or VMWare) and error-prone-but-super-lightweight setup/production scripts. Its architecture built on layers offers an interesting amount of granularity and I felt like I needed to build my own little Hello World.


I chose to build a Docker file for a build image [1] with OpenCV, a computer vision library, and specifically with its Java binding and test its deployment on Google Compute Engine [2]. While very popular, OpenCV isn’t particularly easy to set up and thus makes for a nice use-case for something not completely trivial as a random ‘apt-get install’. Note this is a trusted build, hosted on as a link to the Dockerfile on github and built by the Docker Index system.

After building a binary for OpenCV 2.4.7 together with its Java support (which is not part of the default build and somewhat tedious to generate), I created this simple image that simply places the compiled bits in /opt and places a simple face recognition demo application in the home directory. You’ll note that the build includes the install of an updated version of libc6-dev to satisfy Java OpenCV shared libraries. Docker nicely hides this mess to the user of the image.

Of course, there also needs to be a proper Java installed. This is done by building the OpenCV demo image from another trusted build (alexismp/debian-openjdk) which itself builds off of debian wheezy. As the name implies it installs OpenJDK (7) and configures JAVA_HOME and PATH.

Finally, my OpenCV demo image provisions ANT which is used to run the sample code with a trivial “ant build” command in the demo directory (/home/faceDetect).

small-computeenginesmall-storageRunning this software stack on Google Compute Engine is as easy as pulling the build from Docker’s repository from a Docker-enabled virtual machine [1], running docker with shared directories, and moving the result to Google Cloud Storage :

$ sudo docker pull alexismp/opencv-demo-java7-trusted
$ sudo docker images
alexismp/opencv-demo-java7-trusted latest 4a9f88286d2e 36 hours ago 783.7 MB (virtual 5.123 GB)
$ sudo docker run \
    -v /tmp:/root \
    -t -i alexismp/opencv-demo-java7-trusted \
% cd home/faceDetect/
% ant
% cp *.png /root/
% exit

$ gsutil mb gs://face-detect/
$ gsutil cp /tmp/*.png gs://face-detect/

The OpenCV test uses face detection (not recognition! :) and creates a PNG images boxing the faces it has detected. Note how simple it is to use the Cloud Storage gsutil command-line to create a new bucket and copy the generated image which at this point is available from a RESTful API.


Being on the Google network with my Compute Engine instance made the pull operations pretty painless with great download speeds and the backup to Google Storage plain trivial. I also used a simple persistent disk with docker installed and configured which is booting in just a few seconds.

The next step is to integrate this functionality and make it available as a generic service, FDaaS, Face Detection as a Service! This will require writing a front-end or an offering an API and tweaking the Java code to deal with more flexible input/output.

Using Docker on the Mac currently required me to setup Vagrant, VirtualBox and Docker itself, something between dependency hell and Russian dolls but I’m told I should really look at boot2docker (which also sounds like an interesting solution for docker in production).

Interested in Docker? Their Getting Started page is pretty good. Start there and move to the equally good documentation when needed. Just remember that this is still a dot (0.x) release and officially not suited for production.

[1]: if you find the Docker vocabulary a bit confusing, you’re not alone. Check out this nicely written post :

[2]: Docker on Google Compute Engine –


Google presence at Devoxx Antwerp 2013

Devoxx 2013      google_developers_logo
A busy week is about to start for the Devoxx 2013 participants and speakers (it’s been busy for organizers for many weeks!) and Google is back this year with a lot in store for developers.

Android KitKat
Of course, you’ll hear a lot about the newly released Android 4.4 KitKat from Chet and Romain in a University session, a “What’s new” session, and more (Chet is bringing a tie…). Also covered will be Google Play Games Services with a hands-on lab (by Dan Galpin), an Android performance University session, an “image processing on Android” session by Nicolas Roard, a “Design” by Nick Butcher, and a puzzlers session!

AngularJS is back by popular demand with a lab, a university (both on Monday), a session, and a BOF session with a large portion of the team present at the conference (Igor, Misko, Brad, …). There’s also this related TDD session : “Unit testing JavaScript/CoffeeScript/Dart code with Karma”. The AngularJS BOF/Meetup is scheduled for Wednesday 7pm and I hear it’ll have fine food and drinks…

If you’re curious about how Chrome (Packaged Apps) can help you build rich clients there’s a full university waiting for you (by Jow Marini) and an NFC quickie by François Beaufort. Sam Dutton is back to present on Media APIs and WebRTC progress. Maybe in one of the most important Web sessions, Mike West will help you mitigate the risk of XSS.

The Google Cloud has grown to much more than just App Engine. Ludo will cover Google Compute Engine (infrastructure, VM-based offering), the many new features in App Engine, and how the two can seamlessly play together. Ludo will be busy with another session about how to build scalable RESTful APIs, and finally Martin Gorner with explain BigQuery for dummies (aka Dremel, yet another part of the Google’s Cloud).

If you run a web site or service with mobile users and you’re still in the business of managing your their passwords, I would recommend attending Ian Barber’s “Google Sign-in on mobile devices (Android and iOS)” session.

Finally, Thursday will be “Dart Day” for us starting with the Google keynote by Lars Bak, an industry veteran, author of the HotSpot JVM, of the V8 JavaScript engine and now leading the Dart effort, who will no doubt have a thing or two to say about the future of Web development. Later in the Day, Lars and the team will hold a “Dart – Ask us Anything” session during lunch, will a “Mobile, multi-device, multi-player with HTML5 and Dart” session in the afternoon. The day will end with a 6pm to 8pm happy hours with the Dart team (co-founders Lars Bak and Kasper Lund, Seth Ladd, and a number of other engineers). Make sure to stop by the Google booth early to get your free ticket.

Interviews, Booth, Cloud Credits, Quizz & More!
Similar to last year we’ll be conducting a number of interviews of Google speakers which will later be made available on the Google Developer YouTube channel as well as on Parleys. You are encouraged to ask questions ahead of time using this Moderator link.

We’re also running a Google+ event for Devoxx to share photos, comments and interact with other conference participants.

Devoxx participants, make sure you look for the Google Cloud Credits coupon in your attendee bag and redeem it! Also make sure you try the Google quizz online or at the Google booth, we have a number of nice giveaways for those that do!

And, of course, let’s meet at the Google booth and chat about anything developer!

Devoxx, here we come!

Accélérez vos développements iOS avec la plate-forme Cloud de Google

Mobile backends est une solution qui vous permet de créer des applications mobiles connectées sans avoir à écrire de code coté serveur. Aujourd’hui nous simplifions les développements coté serveur pour les développeurs iOS en proposant “Mobile Backend Starter for iOS”. Avec les bibliothèques Mobile Backend et Objective-C vous pouvez désormais :

  • stocker des données dans le cloud et les partager entre plusieurs utilisateurs
  • envoyer des notifications push entre appareils
  • utiliser des requêtes continues pour notifier les utilisateurs mobiles de modifications des données
  • authentifier les utilisateurs titulaires de comptes Google

Ryan Harter, développeur mobile, a utilisé Mobile Backend Starter pour passer son application Hashnote de 3 000 à 20 000 utilisateurs :

“Le Mobile Backend Starter m’a permis de me concentrer sur mon application Android tout en m’assurant que mon coté serveur était efficace. Ceci dit, cette partie serveur n’est pas une boite noire à tout faire qui m’emprisonne dans une solution spécifique. J’ai fait évoluer ce code serveur pour répondre à des spécificités de mon application Hashnote tout en apprenant comment Google avait implémenté le code initial disponible en Open Source.”

Le Mobile Backend Starter est une application App Engine si bien que vous pouvez supporter des centaines d’utilisateurs concurrents dans la limite de quotas gratuits. Le code source pour l’ensemble de l’application, à la fois la partie backend et les clients Android et iOS clients, est disponible sur Github. Libre à vous d’explorer ce code et d’y intégrer toute modification que vous jugez nécessaire.


Débutez avec Mobile Backend Starter

Vous pouvez essayer Mobile Backend Starter sur un iPhone ou un iPad en quelques étapes (les détails complets se trouvent ici):

  1. Déployez la partie serveur sur App Engine
  2. Téléchargez et configurez le client iOS (ou bien effectuez un clone du code sur GitHub)
  3. Exécutez l’application d’exemple sur un téléphone ou une tablette (note: l’exemple ne fonctionne pas dans le simulateur iOS)


Vous pouvez ensuite utiliser les classes de notre framework pour communiquer avec la partie serveur comme s’il s’agissait de code local iOS. Nous avons en particulier intégré les récents progrès réalisés pour livrer des notifications push fiables et capables d’adresser des milliers de périphériques iOS au travers de l’Apple Push Notification Service.

Les mêmes fonctionnalités sont désormais disponibles pour Android et iOS avec un code coté serveur capable de gérer les spécificités des différentes plate-formes comme l’utilisation de Google Cloud Messaging pour Android et d’APNS pour iOS. Coté Android, vous pouvez suivre ces instructions ou regarder la session Google I/O disponible ici.

– Ecrit par Stuart Reavley, Product Manager, Google Cloud Platform

AppEngine 1.7.7 – incrémental et fondamental

La toute dernière version d’AppEngine (1.7.7, annonce officielle) introduit son lot de nouveautés, comme le support de et sortantes (avec qq restrictions et pour les applications payantes uniquement), mais elle est pour moi surtout marquée par des améliorations incrémentales importantes et pour beaucoup transparentes pour l’utilisateur (c’est l’intérêt d’avoir délégué l’admin à Google dans une approche PaaS). En voici les plus marquantes :

  • déploiements beaucoup plus rapides
  • généralisation de Java 7 (par défaut pour toute nouvelle application)
  • amélioration du plugin Maven, développé par l’équipe AppEngine, propose la génération de code Cloud Endpoints et se trouve (avec ses archetypes) dans Maven Central
  • nouveau scheduling pour un auto-scaling encore plus efficace (perf et donc $/€)
  • amélioration des performance de la console et de ses rapports de charge

Deux autres modifications concernent:

  • la facturation (un nouveau système est maintenant en place) avec la suppression des $2.10 de “ticket d’entrée”
  • l’introduction du Cloud SDK, une consolidation des outils en ligne de commande des différentes offres de Cloud Google: Storage, Compute Engine, CloudSQL, BigQuery et AppEngine

A partir de cette version les logs contiennent maintenant la version AppEngine.

Rendez-vous maintenant à Google I/O (15-17 mai 2013) pour une version avec son lot de nouveautés.
Ship early ship often!

Is the Vert.x episode spotlighting an open source weakness?

With all my Sun years advocating open source and my following closely of the Hudson/Jenkins drama from within Oracle some two years ago, I’ve been tracking the recent vert.x issue with quite some detachment (I’m no longer at Oracle and I’m not involved in any way in this technology) but also with a lot of interest. What was really fascinating was to read everyone’s perspective bias in the public discussion :

  • A (somewhat naive) lead and creator of the project caught in the middle of politics
  • Red Hat’s experience with Netty influencing its current behavior
  • VMWare claiming they have lots of open source experience too
  • The idea that foundations would solve all the IP and governance issues
  • My foundation is better than yours arguments
  • The realization that neither Eclipse nor Apache are ideal
  • Jenkins’ Kohsuke suggesting nonprofits for shared assets
  • The Eclipse Foundation being called once again a trade association
  • etc…

Clearly, as Simon Phipps writes in his column, “In an age of open source, it’s hard to acquire a technology” and this brings up what I think is a paradox for any open source believer :

This recent episode will make it even harder for startups to bet on open source to find funding and for companies to be acquired for their open source assets, thus in turn leading to less usage of open source.

In the end, isn’t this underlying a weakness of the greater open source cause or should open source technologies never be a reason to acquire (or sell) a company?

Google (free) talks from Devoxx

We now have the following five Google sessions from Devoxx 2012 freely available to all on Parleys :

If you like shorter formats, you might enjoy these 3 to 10-minute interviews with some of the Google speakers.