Is it possible to have docker running inside of vmware?

95,260

Solution 1

Yes, it's entirely possible to run Docker in a Linux 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.

VMs with Windows guests may not work, because Docker on Windows uses virtualization to host another Linux VM. Nested virtualization is not officially supported.

Solution 2

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.

Solution 3

  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.
Share:
95,260

Related videos on Youtube

Hamza Ahmed Zia
Author by

Hamza Ahmed Zia

Updated on September 18, 2022

Comments

  • Hamza Ahmed Zia
    Hamza Ahmed Zia over 1 year

    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.

  • Hamza Ahmed Zia
    Hamza Ahmed Zia about 7 years
    Thanks for your answer but please clarify You said"Windows on VMWare also works" but did you mean "Docker on VMWare also works"?
  • Ramhound
    Ramhound about 7 years
    @HamzaAhmedZia "VMWare" What exactly? ESXi? Workstation? Be specific and edit your question. Workstation only exists on Linux and Windows.
  • Hamza Ahmed Zia
    Hamza Ahmed Zia about 7 years
    @Ramhound I mean Workstation. Updated question
  • Ramhound
    Ramhound about 7 years
    @HamzaAhmedZia so in the context of Workstation, the author of this answer indicates, that you can run Docker within a Windows VMWare Workstation VM.
  • Hamza Ahmed Zia
    Hamza Ahmed Zia about 7 years
    @Mikael What is your recommendation for shipping to production since you say you do not recommend to copy data out from the containers?
  • Mikael Kjær
    Mikael Kjær about 7 years
    Install docker on your production machine and spin up your images using that.
  • Dmitry Gusarov
    Dmitry Gusarov about 6 years
    Excellent! Thanks for sharing this. PS: The last line is for PowerShell, without "| iex" that would work in cmd
  • ccook
    ccook about 6 years
    Chocolatey was new to me, this was a nice starting point: hanselman.com/blog/…
  • Tetsujin no Oni
    Tetsujin no Oni almost 6 years
    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.
  • Mohan Radhakrishnan
    Mohan Radhakrishnan almost 4 years
    Docker desktop limitations are here
  • Peter
    Peter almost 4 years
    Thanks. This should be accepted answer not the philosophical one above.