Here are some rough notes describing how to dockerize VMware vSphere CLI and OVF Tool.

Issue

After getting both tools to successfully install on Ubuntu 12.04 (precise), I kept getting the following error when running vmware-cmd:

$ vmware-cmd -U <user> -P <pass> -H <esxi ip> -l

Server version unavailable at 'https://<esxi ip>:443/sdk/vimService.wsdl' at /usr/share/perl5/VMware/VICommon.pm line 551.

Fix

After searching around the Internet, the most commonly suggested fix did not work:

export PERL_LWP_SSL_VERIFY_HOSTNAME=0

What did work for me was installing an older version of libwww-perl through CPAN.

cpan install GAAS/libwww-perl-5.837.tar.gz`

Dockerfile

Here is the complete Dockerfile for building the image.

FROM ubuntu:12.04

# Install dependencies
RUN apt-get update && apt-get install -y wget tar perl make iputils-ping uuid-dev libssl-dev libxml2-dev \
    libarchive-zip-perl libsoap-lite-perl libdata-dump-perl perl-doc libxml-libxml-perl

# Install cpanminus (autoconfigures cpan)
RUN wget -O - http://cpanmin.us | perl - --self-upgrade

# Install OVF Tool and cleanup
ADD VMware-ovftool-3.5.0-1274719-lin.x86_64.bundle ovftool
RUN yes | /bin/bash ovftool --required --console \
    && rm -f ovftool

# Install VMware CLI, old libwww-perl, and cleanup
ADD VMware-vSphere-CLI-5.5.0-1549297.x86_64.tar.gz /
RUN yes | ./vmware-vsphere-cli-distrib/vmware-install.pl -d \
    && rm -rf vmware-vsphere-cli-distrib \
    && cpan install GAAS/libwww-perl-5.837.tar.gz

Building from Dockerfile

To successfully build you will need to have VMware CLI and OVF Tool packages downloaded and in same directory as the Dockerfile.

docker build -t vmware_tools .

Running Tools in Container

Now you have an image that can be used to create a container with VMware CLI and OVF Tool installed. Here is a simple example to list all virtual machines on an ESXi server.

docker run --rm vmware_tools vmware-cmd -U <user> -P <password> -H <esxi ip> -l