Build my own Linux VM to replace MobyLinux VM

Hey folks! I’d like to explore building my own VM disk image. Our industry is regulated and we’re required to document and control OS upgrades and changes. How hard would it be for me to build a .vhdx that would work with Docker on Windows using Linux containers? I was unable to find any documentation about that Linux VM and how it’s built. Thanks for the help!

Make yourself aquinted with Packer! It allows to script the creation of a basebox for a builder of your choise (the operation environment e.g. Hyper-V / Virtualbox / VMware Workstation (will require additional licenses) / many others) using a provisioner of your choice (powershell / bash / ansible / chef / puppet /others) to install and configure additional components.

Seems like you will want to create a windows based basebox. You systems may require support for nested virtualization, depending on whether docker in the vm requires Hyper-V as well.

Thanks for the response, Metin!
Yep we’re absolutely planning to use Packer or some other awesome tool to build and distribute that VM. Right now it looks like I’m using “DockerDesktop.vhdx,” the default option. I’m trying to figure out what the requirements are for me to build my own .vhdx image for Docker for Windows to spin up and then launch Linux containers into. Does that VM need to not have a GUI? Does it need an SSH server? What ports need to be exposed? Can it be any Linux VM that has the Docker daemon installed and exposed? Those are the things I’m looking for. Sorry my initial message wasn’t very clear!

Docker on Linux can only run linux based containers.
Docker on Windows can run Windows and Linux based containers - though the linux containers will be run in a nested vm inside your vm.

Since I have never used Docker on Windows, I can’t realy tell what it requires. Neither did I create a windows basebox with Packer; you can find plenty of examples on Github about how to create base boxes for Windows and Linux.

What is so wrong about running the vms with a bridged network interface and run them inside your lan?

I still haven’t been super clear with what I’m looking for, my bad. Lemme try again. Thanks for your patience!

Right now Docker for Windows is installed on my Windows 10 laptop. In Docker’s settings I’ve got it set to use Linux containers. Docker starts a Linux virtual machine for me, call it MobyLinux. Containers I run from Windows PowerShell execute inside that MobyLinux VM.

I am trying to figure out how to swap out that MobyLinux VM for a VM I personally created. So it would be my Windows 10 laptop with Docker for Windows installed on it. Docker for Windows will still be configured to use Linux containers. Docker for Windows will start MyAwesomeLinux VM for me. Containers I run from Windows PowerShell will execute inside MyAwesomeLinux VM.

I’m trying to figure out what the requirements are for MyAwesomeLinux VM. Does it need specific software installed on it? Does it need to have specific ports allowed in its firewall? Does it need to be a specific Linux distribution?

If you don’t need to run windows containers, the whole approach is way easier :slight_smile:

What you need to do, depends on how you want to use it.

For instance, I did build a Ubuntu 18.04 basebox (UI is XFCE) with for my team, run it with Vagrant on Virtualbox and use Ansible to Install Docker and whatever the team needs. They do work completly inside the vm: they use Eclipse and interact with git within the vm. Of course this makes firewall settings / port forwarding uncessary. Word of warning: Linux UIs on Hyper-V are painfully slow and the whole vm creation is complicated. The required enhanced mode is limited to Ubuntu 16.04/18.04 and arch (see:

Though, If you want to only interact with the VM using SSH, you won’t need a UI inside the VM, but you might require to map a host path into your vm, forward ports to access sshd and all the containers you are planning to do. You might experience encodin problems, if you clone git repos on windows and map them in the VM. Without a UI, Hyper-V supports more Linux flavors.

Depending on which of both approaches you want to use, the options for the OS vary. Though, make sure that you pick an OS that has an official Docker-CE build, like Ubuntu or CentOS.

Still, you will want to use Packer to create your basebox, and probably Vagrant to bootstrap/manage your vm.

Here’s what we’re trying to do. I think your use-case is different than what we’re trying to do. And maybe what we’re trying to do is real weird.

We are primarily a Windows shop. So all our development and operations executes on Windows. We’re wanting to start getting our feet wet in the Docker ocean and try having one small piece of our application in Docker. So the main development of our application will remain in Windows while this very small piece of our app is in Docker using Linux based containers.

After doing some digging it looks like there is a docker-desktop.iso in C:\Program Files\Docker\Docker\resources that is the actual Linux VM. There are two other .iso files mounted to the DockerDesktopVM, according to Hyper-V Manager. C:\Program Files\Docker\Docker\resources\config.iso and C:\Program Files\Docker\Docker\resources\docker.iso.

I’m trying to figure out if it’s even possible to swap out that docker-desktop.iso for an .iso that I myself build. Really similar to this Stack Overflow question, but not using docker-machine

According to some documentation here Docker Machine is no longer the suggested way to use Docker on Windows but to instead Docker Desktop for Windows. Hence why that Stack Overflow question doesn’t seem to apply.

Does it seem possible to build my own docker-desktop.iso that Docker for Windows spins up for me? Or does that sound super weird? Should I instead explore creating a basebox that folks use for all their Docker stuff?

Thanks again for all your help! I really appreciate your time!

Okay. I am afraid your best experience will be with Docker Desktop. Even if you follow the Vagrant approach, your experience will not get any better then it is now.

I am afraid, I can’t help you. Someone else will need to address wether the iso to bootstrap the mobilinux vm can be replaced. If you succeed, what advantage do you expect to archive?

The primary benefit I’m looking for is the control over the operating system the containers run in. We’re in a heavily regulated industry and we have specific standards we’re in compliance with. According to folks in my company we have to follow specific policies of when to upgrade operating systems. By replacing that MobyLinux VM it give us the control we need. I might be able to convince folks that this particular running OS should be subject to different rules, since it’s basically hidden.