Docker running on Centos7 with a Windows 7 container - docker

Is it possible as the title states to run a Docker container with the HOST being Centos7 and the CONTAINER being Windows 7? I have not had any luck with Google pulling down meaningful results, nor is there a solution on SO.
Update, the link to use "boot2docker" offers no real context or any value to solving the problem.

That would not be possible.
The containers all share the hosts kernel, so they cannot be different types of operating system.

Related

Does Docker use different tools to run containers on different Operating Systems?

I am studying the course "Docker Essentials: A Developer Introduction" in "cognitiveclass.ai" and one of the questions was "What tool makes it possible to run Docker containers on operating systems other than Linux?" and the choices where: LinuxByte, OSContainers, Docker Swarm and Linuxkit.
But no matter how much I looked for the answer I couldn't find anything that explain this problem clearly.
I know that Docker Swarm is a tool for managing a cluster of container, also Docker uses Linux virtual machine to run containers on mac and hyper-v for windows.
Its Linuxkit. Docker containers are based on linux containers, so you need to have linux to run them. Linuxkit came as a solution for that.
Read this article to get some idea.

Stack difference between VirtualBox and Docker for Windows

Let say I want run Linux application on Windows laptop. (Let say the application is Mongo and it MUST be Linux Mongo). I have 2 options
I can use VirtualBox to run Linux virtual machine with application
I can use Docker for Windows to run Linux docker image with application
My question is: which solution is expected to have better performance? VirtualBox virtual machine has well known overhead, docker instance is a process with low overhead. But between laptop Windows and docker instance AFAIU Docker for Windows establish intermediate virtual machine with Linux (Hyper-V VM?)
Stack looks similar for both options. Could I say that some option has definitely better performance/resource requirements or it depends on specific details?
I would suggest use Docker instead of VirtualBox.
Docker is like independent platform, in future if you want to run on Mac, Linux or windows you just need to copy few files from one place to other to get it set up everything but with VirtualBox you need to copy whole image or re-configured everything.
Docker provides built-in support for all kind of base images, which will help you to get speedy development.
With the Docker, you can destroy or re-run image with few/one command.
Docker provides an easy way to map local folders with VirtualBox you need to configure that.
VirtualBox is heavy as compared with Docker.
In Docker, you will always get the fresh/clean environment if you decide to use Continuous Deployment.
Network mapping (port externalise) and many more things are easily available with Docker.
Again lastly Go with Docker :)
Hope this get you clear idea, Please let me know if you need any help to setup Docker environment for your development.

How docker container use host OS?

In every docker tutorial, one of the main advantages of the docker is that docker container use host OS. But if that is true, I don't understand why I need to include OS in the image. For example here is image of centOS. I understand that if I want to run centOS in container I must pull this image but where then host OS come? It would be best if someone can point me to some link to read about that because I cannot find appropriate one.
What Docker uses of the host is actually only the OS's kernel.
What you include in the Docker container is not the actual OS (i.e., the kernel), but rather all the files that make up a specific distribution, such as Ubuntu or Fedora, or whatever…
This is also the reason why you can't run Linux containers on Windows and vice-versa (without a VM), because Linux software of course doesn't work with the Windows kernel, and Windows software doesn't work with the Linux kernel.
So, all Docker containers running on a given host share the host OS's kernel.
It actually shares the kernel & required libraries to boot the image from host OS. That's why those images are really small & not like traditional ISO files. It primarily utilizes union file system, cgroups and namespaces to manage the images and containers.
You can give a quick read to below -
https://kjanshair.github.io/2017/07/04/Docker-Containers-vs-System-Processes/
How is Docker different from a normal virtual machine?

Running .Net Core in Docker in Windows Subsystem for Linux

Practically I want to play with .NET Core within Docker.
So as I understand it from this post to give myself the best flexibility I would install "Docker For Windows". Means I can ultimately deploy my .Core app to a container that is either a Windows or a Linux container. However the Linux container is still a Hyper-V managed Linux container.
1) Is there a way to instead use the Windows Subsystem for Linux (WSL) to do this in the Windows 10 Creators Update? Seems like less overhead than have Windows/Docker manage a separate Linux VM for me?
No, running Docker containers in WSL is not supported (link mine):
The docker engine is not a supported scenario in the short term. I would suggest hitting our User Voice page and upvoting Docker if you're looking to run the docker engine.
The docker client however should be running in build 14342. I have been able to run the docker client and connect to a docker engine running in a VM.
As to why it's not supported:
WSL is a clean-room kernel reimplementation. So it can't, for both technical and legal reasons, simply take the kernel components of Docker and "make it work". They would need to reverse-engineer years of ongoing kernel development and reimplement it. (Or take some other nontrivial approach.)

Docker: Mixing distros - any disadvantage?

I am running a RHEL 7 server and I am deploying containers using docker. Since you need to have RHEL servers and containers registered with RHN, I am now thinking of using centos7 docker images rather than RHEL7 ones, to avoid the RHN hassles.
Can anybody see any downside to doing it this way?
Since the kernel is the same you can use any distro available: Why docker has ability to run different linux distribution?.
For example many projects are moving to Alpine Linux because it give you the ability to build very small images: see Docker Official Images are Moving to Alpine Linux.

Resources