Docker in Action

Chris Stryker has recently put a lot of effort into getting LabVIEW to run inside of a Docker Container. This is really exciting news. I think this is really a huge step forward in improving Continuous Integration (CI) with LabVIEW. It offers several advantages over traditional CI methods using Virtual Machines (VMs).

  1. Docker Containers can be spun up on demand. If you are using a VM for each project/LabVIEW version, then you have to keep each one running just in case some CI process needs it. This is resource intensive and most of the time they will just be sitting there idling. Starting with a fresh container for each CI task also means that every task starts in a fresh uncontaminated container. There is no chance for anything to be leftover from a previous job.
  2. Docker Containers are lightweight. Because you are not duplicating the entire OS, the images take up way less disk space and much less memory and CPU when running than a VM. Also the way tagging and layering works in Docker can help save a lot of disk space as well.
  3. Docker Containers can easily be run locally. You can easily and quickly pull a docker image and run a build or test in an isolated environment on your local machine. This makes it really easy to test your changes locally before you push them.

There are still a few things to be worked out with getting everything up and running (such as streamlining the LV licensing and getting VIPM to install – apparently JKI has fixed this but I haven’t tested it yet), but Chris has gotten us really close. There are going to be a lot of developments in this area in the next couple months. Now is a good time to learn about Docker and how it works.

Learning Docker

Docker in Action

If you want to learn the basics about Docker, then Docker in Action is the book you need. It covers everything you need to know in just enough detail. It’s got plenty of examples to illustrate all the details. One criticism for this particular application is that it tends to focus on Linux. However with 1 or 2 exceptions I was able to do all the exercises on Windows. By the time the book is over you will be very comfortable using Docker. If you combine the knowledge in this book with Chris’ article, that should be enough to get you up and running.

The book contains 3 sections. Sections 1 and 2 are of the most interest for CI with LabVIEW. Section 3 is interesting but not very applicable.

  1. Consuming Containers – This section talks about installing Docker and the basics of using containers. It talks about where to get them, how to run them, all the various parameters that can be used when running them, and the docker commands for monitoring and manipulating them. It also talks about storage volumes, networking, and resource controls.
  2. Producing and Distributing Images – This section is all about images. Think of an image as a file system and associated settings and metadata. It is roughly the equivalent of a virtual machine’s virtual harddisk and vmx file (if you use VMWare). This section talks all about how to create images with your desired software on it, how to make those images secure, various ways to distribute them, and ways to automate the building and distribution.
  3. Orchestration – Orchestration is basically building entire systems that consist of multiple docker images that all communicate and work together. This section covers things like automatic load-balancing and recovery of failed services, rolling out and rolling back changes and using Docker Swarm to spread Docker containers out over a cluster of computers. Very interesting stuff, not super useful for CI and LabVIEW, but maybe useful if you are building WebVIs and web services in LabVIEW.

If you are interested in the idea of using Docker containers for Continuous Integration, the next place to stop after reading this book is probably here: https://docs.gitlab.com/runner/executors/docker.html

If you would like to discuss how we can help you setup a Continuous Integration system for LabVIEW, set up an appointment. We would be happy to talk to you.

9 Comments on “Docker in Action

  1. That’s really a game changer for LabVIEW CI, but I still think there a lot of challenges there.
    For instance, I think licensing is still unclear and installing NIPM, VIPM, to get up and running may take a long time for a job, I haven’t tried it yet, but that is my impression.
    Maybe NI sharing specific docker images with all clear and set to run? That would make things much easier. Also using tokens for licensing or something like that would help.
    Anyways, it is good to know it is evolving.

  2. Yes there are still some hoops to jump through. For activating LabVIEW, this might prove useful (just stumbled upon it, haven’t tried it yet, but I have it on good authority that it works): https://www.ni.com/documentation/en/ni-license-manager/latest/manual/automate-activation/

    VIPM licensing I have yet to figure out yet. One thing at a time. The first thing is to get the 20.1 version installed (20.0 won’t install in Docker for some reason). Right now you can manually download 20.1 from jki, but it is a manual process. It would be nice to get it from NIPM like everything else.

    And yes it is certainly evolving, but I think we will have something workable soon.

    An ideal solution would of course be NI hosting built images that you can just pull. They could be unlicensed and you just need to run the license step yourself as part of your own dockerfile. But that would certainly simplify things.

    • You are absolutely right. One step at a time, that is the thing of being the first when “clearing the forest”.

      I would like to hear when you have something workable.

      By the way, nice topic.

    • Just a followup, the NI license manager does not work inside a docker image because for some reason it requires you to be logged in to ni.com. I haven’t figured out a way to do that from inside docker yet, so that route is a no go.

        • I had the same thought, but couldn’t figure out how to do it. I guess you could use some tool like wireshark, burpsuite or postman to monitor the communications back and forth while you do a normal login from a browser and then resend the same http posts using curl or wget?
          Maybe that is the way forward.

          • I thought first in Wireshark, but even if it is possible, I believe you would have to tie this session to NI License App, and this is really starting to get out of my knowledge field. =\

          • I swear that I’ve been able to log in to ni.com in the browser and the license app was ok with that and never asked me to sign in. I assumed it just grabbed a cookie or something. Can another process grab a cookie from a web browser? I don’t know. Maybe I am misremembering things. The reason I remember it working is because I use lastppass and it was always a pain to go copy the password. It was easier to just go to ni.com and let lastpass log in automatically. I’ll have to go try that and see what happens.

Leave a Reply

Your email address will not be published. Required fields are marked *

*