Putting the NetApp Manageability SDK into Docker Containers

The NetApp Manageability SDK, usually shortened to NMSDK, contains the libraries used by many applications to connect and execute actions against NetApp systems. It has libraries for, among others, Java, .NET, Perl, Python, Ruby, and compiled C/C++ binaries for various *nix flavors as well, which means that regardless of your platform, you can write applications and scripts against the NetApp API.

Docker, and containers in general, are great for providing application packaging and the ability to easily distribute an application to any Linux server with a compatible kernel. In order to facilitate this, I have created Dockerfiles for the three scripting languages: Perl, Python, and Ruby. To create the Docker images you will need to download the NMSDK zip file and place it into the same directory as the Dockerfile. Then simply build the image as normal.

For the first Dockerfile (Python) I’ll provide an example of how to build the container image and how to use it. This principle remains the same for the others (Perl and Ruby), so simply duplicate for those.

Python

The Dockerfile:

Creating the Docker image is straight forward:

And now we can add the tagged image to the private Registry:

Once the image is available, we can create additional images using it as a base. First, we need a Python script to execute using the NMSDK. This example Python script, available below, will need to be placed into the same directory as the Dockerfile before building.

Once we have the script and Dockerfile, simply build the container. One interesting thing to note, by setting the ENTRYPOINT value to the path of the script, and the CMD value to empty, we can execute the container just like a CLI script:

This is only an example of how to use the NMSDK without having the respective language or libraries installed directly to the system. You could also use this to create a microservice or a server based application if desired.

Other Languages

Perl

Ruby

If you have any questions or suggestions, please don’t hesitate to reach out to me using the comments below or via Slack.

Andrew Sullivan on GithubAndrew Sullivan on Twitter
Andrew Sullivan
Technical Marketing Engineer at NetApp
Andrew has worked in the information technology industry for over 10 years, with a rich history of database development, DevOps experience, and virtualization. He is currently focused on storage and virtualization automation, and driving simplicity into everyday workflows.

Leave a Reply