Run normal Win32 applications in Docker for Windows - windows

I'm a little bit confused about the concept of Docker for Windows.
Can I create a docker container for windows (and a windows host like Server 2016) and install a normal windows application into that container (simple: notepad.exe; advanced some more complex application programmed in Delphi)?
And can I run this container on every Docker enabled (windows) Host? Does the container starts automatically the application inside? Or can a windows docker container only provide service or webbased applications like an IIS website?

if you have Windows Server 2016, you will be able to launch Windows containers (and you will need a Linux server to launch Linux containers).
See those links
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/manage_docker
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/container_setup
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/containers_welcome
In Windows, your Dockerfile will start with
FROM windowsservercore
instead of the more usual
FROM debian
or
FROM ubuntu
See some examples of IIS in (Windows) docker
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/manage_docker
or a SQL Server in docker
http://26thcentury.com/2016/01/03/dockerfile-to-create-sql-server-express-windows-container-image/

The types of application that are candidates for docker are applications that do not have a UI.
Unlike a VM docker images are very slim having only enough codebase to service a particular use case. You can however create a docker image and use VNC to view a desktop like environment; but you have to go through hoops to configure it. Far easier to have a VM if you need a gui surface.
The strength of docker is to easily create containers of servers and DB back ends. You can even run email servers, or a stack of restful services.
On my laptop I had installed mysql, IIS and PHP. With docker I migrated all of these into an image. I spin it up when I need it and in less than 10 seconds i have a working db backend, an IIS server with PHP interface. I can maintain different versions of mysql, IIS and PHP for different iterations, they are all isolated from each other and run in their own container. When I upgrade my laptop I will not need to install any of these, just the image will work.

I know the topic is a bit old, but since I just tried I thought I'll add my 2ct.
No, you cannot start a Windows application inside a container and expect its windows to appear on your desktop.
While starting such an application is possible, in fact, it's of little use because you won't be able to see or interact with the UI.
For example, you can start notepad.exe in your Windows Core Server container and verify that the process is running (using tasklist instead of taskmanager, which cannot be seen as well).
But you cannot type anything into this notepad instance or access the menu.
Hth,
mav

No. Docker is essentially Linux. Yes, you can run Docker on Windows, but what it in fact does is to install VirtualBox and run a Linux VM inside it. Docker servers generally run on Linux VM's in the cloud. The programs you can put in a Docker container are Linux programs.

Related

How to have multiple GUI displays from multiple bashes of a Linux Docker Container using Vcxsrv in Windows host?

I currently have an Ubuntu docker container to run GUI applications called Gazebo and ROS. I am using Vcxsrv to run the GUIs on my windows host os and am able to display a GUI. However the problem is that I can only display one GUI from one bash of my running docker container at a time as I am able run my first GUI program, Gazebo, in the first docker container bash. But after I run a new bash with "docker exec -it bash" and then run another GUI program, like one called Rviz, I get the error here:
root#:/# rviz
qt.qpa.xcb: could not connect to display [ip here].1:0.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
Aborted
Therefore, I tried to run my "config.xlaunch" file again and then the rviz command but the same error occurred. After, I looked at the small vcxsrv icons in the right of my taskbar and one of them said "DESKTOP-Q:0.0 - 7 clients" which corresponded to my first GUI application running. However, the second icon showed "DESKTOP-Q:1.0 - 0 clients" which should run my second GUI application. Therefore I was wondering what I would need to do for multiple GUI applications to run in multiple docker bashes of the same running container? Thank you.
Turns out I had to change around the DISPLAY environment variable in the Docker container from virtual ethernet to wireless adapter and visa versa. And I did this after I launched one of the GUI programs. After you are able to launch the second GUI program you do not have to switch environment variables anymore. This solution does not seem the best so therefore please feel free to post a better solution.

Is it possible to run Docker Windows container and edit registry (regedit)?

I'm new to Docker and started to read the official documentation & googled around the internet but couldn't find conclusive answer.
I'll describe my situation, I have a program (in C++) that runs as a service on Windows 10 Pro and have configuration details in windows registry (regedit).
Currently if I want to debug it I have a virtual machine of Win 10 Pro and use remote debug.
The reason I don't debug it on my machine is because my program always runs on my machine as a service and I don't want to stop it, also on the VM I edit/change the registry configuration.
So I was thinking using Docker instead of VM, but a question has arisen:
Is it possible to edit the container registry without changing/harming the host machine registry?
Thanks in advance for the help.
There is passing mention in Microsoft Docs:
While a container shares the host operating system's kernel, the container doesn't get unfettered access to it. Instead, the container gets an isolated–and in some cases virtualized–view of the system. For example, a container can access a virtualized version of the file system and registry, but any changes affect only the container and are discarded when it stops. To save data, the container can mount persistent storage such as an Azure Disk or a file share (including Azure Files).
https://learn.microsoft.com/en-us/virtualization/windowscontainers/about/#how-containers-work

How to preconfigure Azure Windows image with SSH to use with Jenkins Windows Agents on Azure Cloud

I am trying to follow these instructions to us the Jenkins Plugin to create Jenkins agents with Azure Virtual Machines (via Azure ARM template).
Azure VM Agents plugin
Under Supported Features, it says:
Windows Agents on Azure Cloud using SSH and JNLP
For Windows images to launch via SSH, the image needs to be preconfigured with SSH.
I am a bit confused by this and I'm not sure what it means.
Does it mean that an SSH Client or Server should be installed on the Windows image?
There doesn't seem to be a option for setting up a Windows Azure VM with SSH access, as there is for a linux VM.
Please can anyone clarify what the set up process is?
(By the way, I have tried an unattended installation of cygwin on the Windows VM to try to run a SSH server, but I am running into a separate problem I am trying to solve. I'd like to know if this is not required.)
Answering my own question now I have got a bit deeper in. In the configuration section of the plugin, under Image Configuration, clicking the help on the launch method clarifies what's required.
It looks like a custom image needs to be custom-prepared with a SSH server pre-installed. However, it also looks like it is possible to launch an image with JNLP instead, so I will try that.
Update
I couldn't get JNLP to work (not sure why) but I did get SSH to work. Ticking the 'Pre-Install SSH in Windows Slave (Check when using Windows and SSH)' box does the trick. There's no need to pre-install on the custom image.

convert a Windows solution into windows docker containers

I'm completely new to docker and I’m not a developer. I was asked to port a windows applications solution to windows containers.
I have an application that uses
A custom service
.Net application
This first two components need to run on same container and I need to modify the window registry of the container to give parameters for them to run.
Then I also have
A webservice WSDL running on IIS
A COM+ application
These two components also need to be configured using windows registry and to run on the same container.
Finally, I need some kind of repository this could be just a drive that both containers need to access so they can generate some files there, and the .Net application of the first container needs to read from an SQL remote database.
My question is, if this is possible and can be done.

Can I create a volume on my windows hyperv docker installation

I need some straight answers about this as the current docker info and general Web info mixes hyperv and vmware info up.
I have installed docker on my windows 10 pro machine. I do not have vmware/virtual box installed I don't need it I have hyperv? I can use docker on a Linux Ubuntu box fairly well and I (think!) I understand volumes. Sorry for the background...
I am developing a node app and I simply want to have a volume within my Linux container mapped to a local directory on my windows machine, this should be simple but everytime I run my (lets say alpine linux) container '-v /c/Users:/somedata' the directory within the Linux /somedata directory is empty?
I just don't get this functionality on Windows? If you have a decent link I would be very grateful as I have been going over the docker info for two days and I feel I am nowhere!
If volumes are not supported between Windows and Linux because of the OS differences would the answer be to use copy within a Docker file? And simply copy my dev files into the container being created?
MANY MANY THANKS IN ADVANCE!
I have been able to get a link to take place, but I don't really know what the rules are, yet.
(I am using Docker for windows 1.12.0-beta21 (build: 5971) )
You have to share the drive(s) in your docker settings (this may require logging in)
The one or two times I've gotten it to work, I used
-v //d/vms/mysql:/var/lib/mysql
(where I have a folder D:\vms\mysql)
(note the "//d" to indicate the drive letter)
I am trying to reproduce this with a different setup, though, and I am not having any luck. Hopefully the next release will make this even easier for us!

Resources