Docker Community Forums

Share and learn in the Docker community.

Ship docker image as a VMware OVF


(Mmumshad) #1

Need some advise around shipping applications. I am building an application that contains a NodeJS based web server, MongoDB database and Redis. I would like to build the application using Docker. But ship the docker image as a VMWare OVF file that can be deployed on a VMware ESX cluster.

I know that as per Docker best practices Microservices architecture, I should be deploying different images for different services such as MongoDB and Redis in my case.

So why do I want to ship it as an OVF? My target users need not know docker necessarily. The application should be easy to deploy for someone who do not have docker experience. With all services in a single VM makes it easy to troubleshoot issues. As in, all log files will be saved in the /var/log directory for different services and we can see status of all different services at once. Rather than the user having to look into each docker service.

How do I export a docker image as a VMware OVF/vAPP? Is this a bad approach? Is this not a right use case of docker? If not what is the right way to do it?


(David Maze) #2

(So, three containers.)

I would do this by building a VMWare image of your choice of Linux distribution, with Docker installed, and with the images that make up your application docker load or docker pull into it, and probably a script that runs the application.

One of the things that makes Docker containers lighter-weight than full-blown VMs is that a virtual machine image needs to include some software (e.g., a Linux kernel, an init system, network setup code) that a container simply doesn’t run. It doesn’t really make sense to try to directly convert a container to a VM or vice versa.

The application I work on is distributed as a docker save tar file plus a set of shell scripts to run the combined application. We expect our customers’ administrators will be able to install Docker but not necessarily know its details well. Log files from containers are exported into a directory, and our provided setup also collects logs via an ELK setup. I think the overall approach is reasonable, but I also don’t think you can directly convert a Docker image (or several) into a VM.


(Mmumshad) #3

Thank you for the reply. :slight_smile: Appreciate it!


(John Rofrano) #4

Just an alternate suggestion to consider (I know you already have an answer):

Shipping multi-gigabyte OVF’s defeats the whole purpose of using light-weight Docker containers and it violates the DevOps principal of Infrastructure as Code. :wink: (besides, if it’s a corporate environment they are probably NOT going to just run your VM without it being hardened and passing their security checks and compliance)

One option is to put your code into GitHub and use Docker Compose to build and run it. In the git repo, create an install shell script that is basically:

  • install Docker Engine
  • install Docker Compose
  • docker-compose up

For example, with Ubuntu it would be something like:

    sudo apt-get update
    sudo apt-get install docker-engine
    sudo easy_install pip
    sudo pip install docker-compose
    docker-compose up -d

The client would simply spin up one of their own VM’s from a template that they already have which already contains all of the security compliance that their corporation requires, git clone the repository and run your install script. It would then create your images via Docker Compose and run your containers. If you can’t use GitHub, send it to them in a tar-ball or zip file. It will still be way smaller than a VM.

I would also use three separate containers for isolation. Having all of the logs in one place is as simple as sharing a volume between the containers. You could even share the /var/log directory of the host VM so that the admins look in the same place they have always looked for log files. They don’t even need to know that containers exist at all. They would start and stop the application with docker-compose start and docker-compose stop.

I agree with @dmaze that if you really want to ship an OVF, create your own VM, install docker and your images and deliver the VM to them but that would not be my first choice. Try to build and deploy all of your infrastructure as code. Technologies like docker-compose help you to do this. Just a thought.

~jr


(Mmumshad) #5

@rofrano Thank you very much!! Makes a lot of sense.


(Schemaczar) #6

Any results from this, @mmumshad?


(Chhex) #7

Why the overhead of docker?