Docker Community Forums

Share and learn in the Docker community.

Linux container on Windows docker host


(Tdreher) #1

I am searching high and low for this information but cannot find a clear cut answer:
I would like to run RHEL / Centos containers on a windows docker host.
I read that the host system must be the same OS as the container OS, but then also again that docker provides a Linux VM as a basis on a Windows host.

Is it possible or not?


(Mario Pietsch) #2

Hi,

Short: Yes, it should be possible if you meet some requirements.

Long: ---------

IMO there’s some confusion going on, since several different things are called: “Docker for/on Windows”

You can install “Docker for Windows” as described at the [1] Getting Started page from docker.com … There are some requirements you’ll need. Windows 10 Pro or higher, with Hyper-V support enabled.

The following will happen:

  • You’ll install a native windows App “Docker for Windows.exe” that’s basically a “manager app” the does several things:
  • It sets up a “Hyper-V VM” named: MobyLinuxVM, which contains a minimal linux system, that is able to run docker containers.
  • If you start your: Hyper-V Manager program, you’ll be able to see it.
  • If started, it shows up at the bottom right app toolbar with the “Docker Moby Icon”
  • If you start PowerShell and type: docker version you should see something like this (I’m using the beta channel here):
> docker version

Client:
 Version:      1.13.0-rc3
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   4d92237
 Built:        Tue Dec  6 01:15:44 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.13.0-rc3
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   4d92237
 Built:        Tue Dec  6 01:15:44 2016
 OS/Arch:      linux/amd64
 Experimental: true
  • Now you should be able to run the following command:
    • docker run -it --rm centos bash
    • It will pull down the CentOs image [5] from docker-hub ~70 MB and run a bash console.

Microsoft supports the “container mechanism” natively with their latest OSes. See [2] and [3]. They refer to it as “Docker on Windows”, which imo is a bit confusing since there isn’t enough difference to “Docker for Windows” described above. That’s not what you want. It’s for native windows server / nanoserver stuff.


To make the confusion perfect there is Docker Toolbox, that provides you with a VirtualBox based system, if you don’t have the possibility to use Hyper-V. Have a look at the Docker Docs [4] for more info about this one.

hope that helps
have fun!

[1] Getting Started: https://docs.docker.com/docker-for-windows/
[2] Additional Info from MS: https://msdn.microsoft.com/en-us/virtualization/windowscontainers/about/index
[3] “Docker on Windows” https://msdn.microsoft.com/en-us/virtualization/windowscontainers/docker/configure_docker_daemon
[4] Docker Toolbox: https://docs.docker.com/toolbox/overview/
[5] https://hub.docker.com/_/centos/


(Tdreher) #3

Thank you Mario, your help is appreciated!


(Plinyar) #4

Thanks. I also spent plenty of time to clear up the confusion.


(Dretta) #5

Hi @pmario, I’m in the same situation as @tdreher. I want to use docker for windows to run Linux. However the app I’m developing has some graphical dependencies, getting access to the container’s terminal isn’t enough. Can docker run a GUI of the container? I’ve looked at the “run” command docs but I couldn’t find anything about it.


(Mario Pietsch) #6

Hi,
I think, that’s not what docker is designed for. … Containers should be micro-services, that you can start / stop and throw away, at will. …

There are several experiments out there, that make GUI apps work in containers. But most of them use the same OS. … So eg: linux host-OS with linux container that runs Chrome or FireFox or a Terminal. …

The communication between the host-OS X-window system and the container uses system sockets. Since everything is native, it’s high performance.

Using Docker for Windows the communication would look like this:

windows host -> hyper-v VM -> mobiLinux -> your app-container + X-window-container/services -> windows-host-> x-window-client-app that connects with eg: RDP and shows the GUI …

I would say that’s “doing it by the most complicated means possible”.


I personally would use the existing Hyper-V VM + tools and use a stripped down Linux-System with, just enough stuff, to run the app and the UI.


But anyway:

There’s an other thread: Does it possible to run GUI base desktop application on Dockers

which mentions this project: https://github.com/deskor/xrdp

have fun!


(Andy2222) #7

Yeah i was also surprised that one of the most used crashplan docker containers uses this method to connect to the linux interface.

You basically get a x11 session inside your browser, ugly but actually works well, except for the clunky copy&paste method and some resolution problems.