Windows Image on Docker - docker

How can I create an image in Docker with Windows as the base OS.
For instance; the 'FROM' command in a Dockerfile is used to load the base OS kernel. Eg: 'FROM ubuntu'(ubuntu kernel in this case).
Is there a way in which I can run a command like 'FROM windows7'.
I need it to setup image for build purpose, since I need to run Microsoft compiler 'cl' ; which runs only on windows.
So the dockerfile will look something like:
FROM windows7
RUN install cl
...

Not yet!
Docker depends on the sharing of an linux kernel.
In the moment Microsoft and Docker are working on a Windows version, sharing the windows kernel. This is already working! But only for windows 10 insider build. Where a special linux kernel like micro windows is included, which is then the base for the windows container.
A
FROM windows7
will never exist. Depending on the architecture of windows7.

Related

Regarding Docker cross platform compatibility

I want to ask about cross platform compatibilty of Docker ,means if an application is designed to run in a docker container on windows,then can it run on linux or vice -versa?
Docker was create to run on Linux, so the short answer is yes.
The Windows version isn’t stable or recommend (Docker for windows). At least not by now.
“But, Fischer, I use Docker on Windows!” Yes, with WSL (windows subsystem for linux - Some kind of VM), which you can configure to set a memory limit, using the .wsconfig file, and if you look at your Windows Menu you may found a Ubuntu icon, that connects you to the bash.
Docker is largely used for people that develop software, and today many languanges and frameworks use linux, even Microsoft with .Net runs on Linux.
Docker was created to resolve one simple issue: "But it works on my machine." So, it means that a container should run on every platform. At least "it works on my computer" lol
I think the question is regarding a Windows application. If that's the case, a Windows application cannot simply run on Linux containers. For example, .Net Framework doesn't run on Linux. If an application was targeted for Windows, it needs to run on Windows and in that case only a Windows container can run the application.
Docker Desktop can run both: Windows containers and Linux containers, just not at the same time. You have to switch the context so Docker Desktop can target either WSL (for Linux) or HCS (for Windows).

How to run a portable executable in a docker on linux system

I am working on a application to deploy challenges for ctfs.
I want to include windows service type challenges, too.
How can I deploy a Portable Executable file on a linux based server?
You can not use docker to run Microsoft Windows. To run Windows executables on linux, you can try to use wine or rely on Virtualization (with a full windows installation inside).
You could also have a look at .net for linux to implement your challenge. This article should get you started if this is what you chose.

Docker for linux is giving error

I am new learner for Docker.I have a very simple question.
I want my application to work on Linux system but I am writing application in Windows.So do I need to install Docker for Windows or Linux?
If I run using Docker for Linux,i am not getting option to run in windows and it is getting failed(I understand it might be some other unrelated error) but I need to confirm if my approach is correct or not.
Am I right in installing Docker for Linux?
Also,in case I plan to move to AWS, what docker I need in that case.
Thanks
Consider docker as any software. if your OS is windows you install windows version of a software. if your is a linux distro then you install linux version of a software.
So you need to install docker for windows afterwards you can install any docker image/container you want under your operating system. Could be windows, linux or anything else.

Create docker image running old Windows version

I am new to docker and my task is to create docker container running Windows 98.
The difficult part is not having Windows 98 installed. My computer has Windows 7/Kubuntu 16 (dual boot).
I am looking for some way of getting ready Windows98 docker image or creating it using these operational systems.
P.S. I think I need to clarify: I prefer to run docker over Kubuntu, not Windows (if possible).
The docker image should run Windows98 inside.
Here you can find official images from Microsoft for docker.
As you can see there are only Nano Server and Windows Server Core containers available.
Unfortunately for Windows98, you would need to use regular VM.

Can I use a Windows .Net app with Docker?

I'm a little confused by all the chat about Docker, and how it fits into the virtualisation world. So here's a straight question: can I package up a .Net application (that normally runs on Windows 7 etc) to run in a Docker container, and then execute it on 'any' host supporting Docker?
TIA.
Not today. In future, Microsoft and Docker have announced that you there will be a Windows version of Docker.
Edit: newer info
Note that the base platform and OS have to match - i.e. today you can run ARM Linux containers on ARM Linux and x64 Linux containers on x64 Linux, but you can't mix and match. When Windows is added, the pattern will be the same - you will be able to run Windows containers on Windows OS, but not on Linux. Not without an extra layer of virtualization (like VirtualBox, VMWare, etc).
Edit: respect to the Wine answer, which I hadn't considered. It sort-of fits as "an extra layer of virtualization", but at the OS API level not the hardware level. And somewhat restricted in scope of .Net programs supported.
In a similar vein, you might be able to run your .Net code in Docker using Mono.
Docker builds on Linux. The only way to get the .Net app run in Docker is by using Mono for Linux.
Yes, if you install wine and .NET, here is an example of such a Dockerfile
https://registry.hub.docker.com/u/justmoon/wix/dockerfile/
extract
# Install .NET Framework 4.0
RUN wine wineboot && xvfb-run winetricks --unattended dotnet40 corefonts
This maybe very out of date question, but I think it need a update. Yes you can use docker with .net / .net core and will fully support in Visual Studio 2017.
https://channel9.msdn.com/Events/Connect/2016/172
The be no need to use WINE or Mono.
below is example dockerfile to run .net 4.5 app
FROM microsoft/iis
RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"]
RUN ["powershell.exe", "Install-WindowsFeature Web-Asp-Net45"]
ADD publisedDir/ c:\\website
EXPOSE 8081
RUN powershell New-Website -Name 'websiteName' -Port 8081 -PhysicalPath 'c:\website' -ApplicationPool '.NET v4.5'
ENTRYPOINT powershell
A bit late, but still if it helps anyone.
Yes we can run .Net apps on Docker as docker is now supported with Windows natively. But first you have to check your windows version, your windows build must be 14393.233 or greater. Download Docker 1.13.0 or later and then you can easily run a .Net App.
This repository
walks through running a sample .Net App.

Resources