Testing Docker Containers? 3 Ways to Go Local

Docker containers are powerful, but they’re not always simple to test in a local environment. Still, there are ways to run Docker locally for testing purposes using tools such as Vagrant, Kitematic or just Docker itself. Here’s an outline of each of these methods, with the advantages and drawbacks of each approach.

Method 1: Run Docker on its Own

Let’s start with the most basic method, which is to run Docker locally. On any Linux computer, you can install Docker Engine and the rest of the Docker tool set by either using your distribution’s prebuilt packages or grabbing the Docker installer straight from Docker.

Once you have installed Docker on your Linux system, you can use the command line interface (CLI) to build and manage containers.

The advantage to this approach is that it requires no overhead, since you don’t have to rely on virtual machines or other resource-intensive tools to get Docker working. The major drawback is that this method only works on Linux. (You could install Docker locally on a Windows or Mac OS X computer, too, but in that case you’d need to use VirtualBox or another hypervisor to run your containers. That entails a considerable resource overhead.)

Method 2: Kitematic

Kitematic is a handy tool for installing and running Docker locally via a graphical user interface (GUI). It’s now part of the official Docker Toolbox, so installing Kitematic is as simple as downloading and running the installer for Docker Toolbox.

Kitematic provides an easy-to-use GUI environment for creating and managing Docker containers. It also lets you open terminals inside containers or access the Docker Engine CLI client for times when you need to work from the command line.

Kitematic works by installing VirtualBox and creating virtual machines in which your containers actually run. But the tool does all of that busy work for you in the background.

The advantages to the Kitematic approach are it’s ease of use and its support of Windows and Mac OS X. (It doesn’t currently support Linux, at least not officially.) The downside is that it needs VirtualBox to work, and VirtualBox virtual machines will suck up a fair amount of your system’s resources when they are turned on.

Method 3: Vagrant

HashiCorp’s Vagrant tool is similar to Kitematic in that it automates much of the process required to run Docker locally using virtual machines. Basically, you install Vagrant, then run a few commands to tell it to create virtual machines via VirtualBox and set up containers in them.

Vagrant has the advantage of supporting all major versions of Linux, as well as Mac OS X and Windows. The drawbacks are that it’s somewhat more complicated to use than Kitematic—it lacks a GUI, and sometimes installing Vagrant is not as straightforward as it’s supposed to be. Also, like Kitematic, Vagrant relies on virtual machines.

Conclusion

The bottom line: If you are comfortable working within a Linux environment, the simplest and most efficient way to test Docker is to run it directly on a Linux PC. But if you need to work from a Windows or Mac environment and don’t mind some resource overhead, Kitematic and Vagrant both offer convenient ways to test Docker containers locally.

Christopher Tozzi

Christopher Tozzi

Christopher Tozzi has covered technology and business news for nearly a decade, specializing in open source, containers, big data, networking and security. He is currently Senior Editor and DevOps Analyst with Fixate.io and Sweetcode.io.

Christopher Tozzi has 254 posts and counting. See all posts by Christopher Tozzi