18

I run vmware workstation for my dev needs and have to maintain different VMs for diff environments.

Docker seems to allow running diff environments in containers, therefore

  1. Inside of my Windows 10 x64 VM can I run docker and use different images and containers to develop, build and test my code? (Remember I'm running my dev envrionment in VMware Workstation while docker uses VirtualBox)

  2. How do I ship/take this my app (code+database+web api+ .....) to production? Does the the production machine need to run docker we well?

Please help clarify.

Update

By VMWare I mean VMWare workstation pro.

11

Yes, it's entirely possible to run Docker in a VM. Docker is a light virtualization solution, it doesn't virtualize hardware so you won't be affected by problems typical for nested VMs.

Port binding may be a bit tricky though, because you'll have to somehow connect your dev-env VM in VMware with Docker VM in VirtualBox.

You may also run into problems if you want to expose host's folders to a service in a Docker container. Windows' file systems are limited compared to Linux ones in terms of permission granularity and some services don't like that. (this issue is not Docker-specific)

In general, your app isn't locked to Docker in production. Dockerized services communicate with the world through network, no different than what regular services usually do. However, an app designed with Docker (or, more generally, cloud) in mind may be more resilient to failures and easier to maintain.

5

This blog talks about exactly how to use Docker on Windows with VMWare Workstation. You can even use Windows 7.

https://stefanscherer.github.io/yes-you-can-docker-on-windows-7/

First install the Chocolatey package manager for windows (this is a one-line command)

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

then install Docker to use VMWare workstation

choco install -y docker  
choco install -y docker-machine  
choco install -y docker-machine-vmwareworkstation  

Create a default vm

docker-machine --native-ssh create -d vmwareworkstation default  

Set your environment variables

docker-machine env | iex

Now you are all set to get started.

  • Excellent! Thanks for sharing this. PS: The last line is for PowerShell, without "| iex" that would work in cmd – Dmitry Gusarov Mar 6 '18 at 7:45
  • Chocolatey was new to me, this was a nice starting point: hanselman.com/blog/… – ccook Apr 11 '18 at 18:14
  • 1
    Just in case anyone else tried this without reading the link the "Create a default vm" command should be: docker-machine --native-ssh create -d vmwareworkstation default (Note missing "-") – Neil Aug 11 '18 at 15:41
2
  1. Yes, you can run docker on Windows. Windows on VMWare also works. We run docker on Linux servers on VMWare.
  2. The smartest would be to have docker on you production machine also, but it would be possible to copy your data out from the containers. I don't recommend that though.
    You can use docker save to save your docker images to files.
    I think it's worth mentioning that it's not recommended running several applications inside the same container and it's not recommended to store data inside your containers, you should use volumes for that.
  • Thanks for your answer but please clarify You said"Windows on VMWare also works" but did you mean "Docker on VMWare also works"? – Hamza Ahmed Zia Apr 5 '17 at 10:56
  • @HamzaAhmedZia "VMWare" What exactly? ESXi? Workstation? Be specific and edit your question. Workstation only exists on Linux and Windows. – Ramhound Apr 5 '17 at 10:57
  • @Ramhound I mean Workstation. Updated question – Hamza Ahmed Zia Apr 5 '17 at 10:59
  • @HamzaAhmedZia so in the context of Workstation, the author of this answer indicates, that you can run Docker within a Windows VMWare Workstation VM. – Ramhound Apr 5 '17 at 11:00
  • @Mikael What is your recommendation for shipping to production since you say you do not recommend to copy data out from the containers? – Hamza Ahmed Zia Apr 5 '17 at 11:03
0

There is a major difference between the docker host (Linux or Windows) :

So on the Windows docker host in a Vmware Workstation (on your physical Windows), you have a nested HyperV Linux VM ! That's not a big issue, just be careful to enable nested virtualization.

François

  • That point about Windows hosting a HyperV VM is incorrect if running Docker for Windows in Windows Container mode and using LCoW side-by-side. It has other problems, but the linked articles stance about the agnosticism of Docker based on host OS is short-sighted at best based on where Moby Project is heading with Windows container based docker on Win 10. But I just sank a week into discovering that the bleeding edge is still drawing blood, and not backed down to the danger level of only leading-edge. At this point it looks like another six months until it is ready as a daily driver. – Tetsujin no Oni May 22 '18 at 4:22

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.