Can I run Docker in VMWare?

Running Docker in a virtualized environment like VMWare can provide additional flexibility and portability for containerized applications. There are a few methods available to run Docker inside VMWare, each with their own advantages.

Can I run Docker in VMWare?

Overview of Docker and VMWare

Docker is an open platform for developing, shipping, and running applications within software containers. Containers allow a developer to bundle up an application with all of the parts it needs, such as libraries and dependencies, and ship it as one standardized unit.

VMWare offers various virtualization products that provide cloud computing and platform virtualization software and services. This allows you to run multiple virtual machines with different operating systems and environments on a single physical machine.

Integrating these two technologies can provide additional flexibility in how and where you deploy containerized applications.

Methods for running Docker in VMWare

There are three main methods for running Docker inside a VMWare virtualized environment:

1. Docker Machine driver for VMWare

One option is to use Docker Machine to install and configure Docker Engine inside a VMWare virtual machine (VM). The Docker Machine VMWare driver makes this integration simple by automating the VM creation and Docker installation process.

To use this option:

  • Install Docker Machine on your local system
  • Install a VMWare product like VMWare Workstation or VMWare Fusion
  • Use the VMWare driver with docker-machine create to provision and configure a VM with Docker Engine

Copy code

docker-machine create –driver vmware my-docker-vm

This allows you to work with the Docker CLI pointed at the Docker Engine running inside the VMWare VM.

2. Run Docker inside a Linux VM

You can manually configure a Linux-based VM using VMWare products and install Docker Engine inside it. For example, create an Ubuntu VM, install Docker CE according to the standard install instructions, and work with containers from inside the VM.

This gives you more control over the VM setup compared to using Docker Machine. However, the installation and configuration needs to be done manually.

3. Use VMWare vSphere Integrated Containers

VMWare offers the vSphere Integrated Containers (VIC) platform which allows you to natively deploy Docker containers onto virtual machines running on vSphere.

VIC uses vSphere infrastructure while providing a Docker API endpoint for container management. Behind the scenes, it uses resource pools and VMs to allow running container workloads alongside traditional VM workloads on the same infrastructure.

Using VIC requires running VMWare vSphere and additional components, so it involves more moving parts than the other options on this list. However, it also offers tighter and native integration between VMWare infrastructure and Docker containers.

Key advantages and use cases

Some of the advantages of running Docker in VMWare include:

  • Isolation – Containers can run safely inside a separate VM instead of directly on the host. This adds an extra layer of isolation and security.
  • Resource allocation – You can provision a powerful VM and dedicate resources like CPU, memory, and disk to power container workloads.
  • Migration – VMs can be easily migrated across hosts while containers continue running inside. This allows for flexible workload mobility.
  • Multi-tenancy – Run multiple containerized microservices isolated from each other within their own VMs.

Use cases where running Docker in VMWare shines:

  • Providing Docker infrastructure to development teams where hardware resources are limited
  • Scaling up containerized workloads by giving them dedicated VMs with ample resources
  • Running untrusted or isolated containers inside locked down VMs

And more – any situation where hardware virtualization adds value on top of software containerization.

Working with persistent data

When running databases, caches, and other stateful services inside containers, you need to account for persistent data storage. The container itself is ephemeral, but the data should outlive any one container instance.

There are a few good options to provide persistent storage with VMWare and Docker:

  • Docker volumes – Map designated filesystem paths from the VM to Docker volumes which get mounted into containers. This persists data even when containers get rebuilt.
  • vmSCSI/RDM disks – Provide direct access from the VM to physical SAN/NAS volumes using raw device mapping (RDM). This works well for persistent block storage.
  • NFS shares – Configure network shares from a NAS filer and mount them into VMs. Containers running in the VM can leverage shared filesystem storage.

Be sure to architect persistence appropriately to avoid losing important container data.

Conclusion

Running Docker inside VMWare virtual machines provides compelling advantages like additional isolation and flexible resource allocation. There are a few good options available – Docker Machine, manual configuration, and native integration with vSphere Integrated Containers.

Understanding the methods for integrating these technologies helps architects and administrators unlock the best of both worlds. Containers provide application portability and efficiency, while virtualization offers hardened multi-tenant infrastructure. Together they provide a potent combination for modern application deployment and management.

Key Takeaway

The key takeaway is that Docker and VMWare can be integrated to containerize applications within virtual machines safely and efficiently. This provides flexibility in running containerized microservices in a virtualized environment with ample resource isolation and allocation. Persistent data can be provided using shared volumes, block storage devices, and network shares. With a few different options available, architects can choose the best method based on their infrastructure and requirements.

FAQs for users regarding running Docker in VMWare:

  • Can I run the Docker Engine inside a VM in VMware Workstation/Fusion?
    Yes, Docker Engine can be installed and run inside a Linux VM within VMware Workstation/Fusion. The VM provides additional isolation and flexibility over running Docker directly on the host.
  • Is data in Docker containers lost when the VM is shut down?
    It depends. Local container file data not written to persistent storage will be lost. However, proper use of Docker volumes, NFS shares, or RDM disks will persist data safely outside the short-lived containers.
  • How big should I make the VM to run Docker?
    Base your VM sizing for Docker on the number of containers you intend to run. VMs running few containers may only need 1-2 vCPUs and 2-4GB RAM. High utilitzation cluster nodes may need 8+ vCPUs and 8+GB RAM. Always size based on anticipated workload levels.
  • Does Docker run faster on a Linux VM or natively on my Windows/Mac?
    In most cases the performance will be better when running Docker Engine natively on Linux rather than from within a VM. The extra virtualization layer adds some overhead. However in practice, for many apps the performance is usually acceptable when running in a properly sized Linux VM.
  • Will I have access to GPUs and accelerated computing inside a VM running Docker?
    VMs do support configuring access to GPUs, FPGAs, and other advanced hardware within the guest OS. However you need an adequately powered physical host, correct device drivers, and specialized VM configuration. Performance tradeoffs should be evaluated based on application requirements.
  • What applications benefit from running Docker in a VM?
    Running Docker in VMs adds the most value for isolated, untrusted workloads and multi-tenant environments. For example, allowing developer teams to safely spin up test environments without impacting others on the same infrastructure. VMs also aid in portability across systems.
  • How do I configure networking with Docker inside a VM?
    The VM networking will determine what container networking options are available. Bridged networking provides the same abilities as Docker on a native host, including cross-VM connectivity. NAT networking limits accessibility but maintains isolation. Consider networking requirements when designing architecture.
  • Can Kubernetes run on top of VMs hosting Docker containers? Yes, Kubernetes and its container orchestration features can run and manage a Docker cluster comprised of virtualized node hosts. Each VM node runs the Docker engine and containers. Kubernetes manages deployment, scaling, networking, etc across the cluster.
  • Is it better to use Docker Machine or manual configuration inside VMs? Docker Machine makes getting started with Docker in VMs very quick and simple. But manual configuration allows for more customization in how the VMs and Docker engine are set up. Evaluate both approaches against your use case to determine the best method.

Leave a Comment