Is it time for IDEs to support Container-based Development?
Last week, I encountered a subtle bug in JDK 8 u112. While digging around for info to reproduce and report the bug, I sifted thru the source code of OpenJDK. This got me thinking “how about fixing the bug and submitting a patch?” :) So, I cloned OpenJDK repo and followed the instructions to build it. As usual, the build failed as Xcode 4 was required but I only had Xcode 8 on my Macbook Pro. Duh!
At this point, I thought “could I use a Linux container to build this code on my Macbook Pro?” May be, I can download a Ubuntu image that had all software required to build OpenJDK, spin up a container, clone the code base, and explore the fixes. So, I looked around on Docker Hub and asked around if there was such an image. Unfortunately, there was none.
So, I decided to build a Docker image for this purpose. As I was dabbling thru the steps to build a Docker image, I started thinking how would I develop and test the fix? Sure, I could run the build and test commands within the container. However, this wouldn’t help me in viewing, understanding, and modifying the code in an IDE. Of course, I could share a host volume/folder with the container and then switch between an IDE on the host to modify the code and a shell in the container to execute the code. The downside of this solution is that I cannot use the IDE to debug the modified code at run time; at least, not without non-trivial manual effort.
Upon searching, I found IDE-based tools/solutions to develop Docker images, spin up containers, and manage containers or swarms. However, there were no solutions to
- modify code on the host and build it in a container with minimal overhead, i.e., not build a new container for every build. A shared volume seemed like a possible solution. However, is it the best solution?
- trigger builds in a container from within an IDE (running on the host).
- execute built binaries in a container from within an IDE.
- “remotely” connect to and debug executions of built binaries occurring in a container from within an IDE. By “debug”, I mean the typical activities such as placing breakpoints, stepping in/out/over, examining variables, and evaluating expressions. While I can see how this could be possible for VM based languages, I am not sure how to make this (easily?) possible for languages that compile down to native code.
Today, there is no solution that would allow us to have the same debugging experience with our favorite IDE as we do on our dev boxes but with the IDE running on the host and the target code running in containers.
Taking stock, there is an increasing interest in and access to container technology. Almost all development capable hardware is capable of running containers. Containers are increasingly used in development, e.g., avoid configuration mismatch. Containers can enable cross-platform development. In terms of technology, the support for remote debugging has been around for a while. Most commonly used debugging infrastructure (e.g., gdb, jdb) support remote debugging. Containers can expose ports. So, it seems the time is right for IDEs to provide first-class support for seamlessly develop with containers (aka container-based development).
I want it in 2017 and I am sure other developers want it as well. Now, I hope the IDE vendors agree with us :)