Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use a Windows .Net app with Docker?

Tags:

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.

like image 312
haughtonomous Avatar asked Nov 25 '14 14:11

haughtonomous


People also ask

Can I run .NET application in Docker?

Docker is a containerization service, used for running applications in isolated environments packaged with all the dependencies and code it needs to function. It can run all kinds of applications, including . NET-based programs using Microsoft-provided runtime images.

Can you run Windows apps in Docker?

You can run any application in Docker as long as it can be installed and executed unattended, and the base operating system supports the app. Windows Server Core runs in Docker which means you can run pretty much any server or console application in Docker.

Can .NET application be containerized?

NET Framework application must run on Windows, period. If you want to containerize existing . NET Framework applications and you can't or don't want to invest in a migration to . NET Core or later("If it works properly, don't migrate it"), the only choice you have for containers is to use Windows Containers.

Does Docker support .NET framework?

There are two supported frameworks for building server-side containerized Docker applications with . NET: . NET Framework and .


4 Answers

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.

like image 96
Bryan Avatar answered Oct 16 '22 12:10

Bryan


Docker builds on Linux. The only way to get the .Net app run in Docker is by using Mono for Linux.

like image 24
Günter Zöchbauer Avatar answered Oct 16 '22 12:10

Günter Zöchbauer


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

like image 4
user2915097 Avatar answered Oct 16 '22 12:10

user2915097


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.

like image 3
CRAIG ADAMS Avatar answered Oct 16 '22 13:10

CRAIG ADAMS