convert a Windows solution into windows docker containers - windows

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.

Related

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

Run normal Win32 applications in Docker for 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.

Windows Service unable to open COM port

We have a windows service (written in C#) that uses a 3rd party DLL to communicate with a COM printer.
Already tested the windows service in 4 local machines, and in every case the printer works correctly.
We also have this windows service already deployed in production in several clients and it also works correctly, but now we where deploying it to a new client and in every test we make the DLL is unable to open the COM port (already checked to see if it's in use by another application and nothing).
But the strangest thing is that if we launch the service .exe from command line it works correctly, so we tried launching the service as the user connected to the machine (instead of Local System) and even so it doesn't work.
What can be causing this? Is there any way, either by Windows configuration or by some software, to prevent Windows Service to communicate with the COM port? Or is there any other explanation?
Sorry to all of you that came here looking for a solution to your problem, but my solution was to change the 3rd party DLL.

Access windows application installed in EC2 using browser

I have installed QAD Netui Client (application with .exe executable) on Windows EC2 instance.
I would like to access that application through web browser or by any other way without the need of logging-in into windows instance.
The reason behind this requirement is that, I don't want users to get information about machine on which my application is installed.
Is there any way to achieve this requirement ?
Not likely. This appears to be a Window GUI application rather than something like a web application.
As a GUI application it needs a Windows desktop session to run. This is accomplished with remote desktop or other similar application that allows you to share a desktop with another client.
However, you can set up a Windows user profile that has much more restricted access to the machine. This is probably the closest you will get.

standalone web application

Is there way to run web application as standalone desktop application? Could be web application written using PHP, MySQL and Apache converted to standalone application which meets following requirements:
1. Application should be called as http://myapp.localhost.
2. Application should have desktop icon which directly opens browser with application's URL.
3. Source code of web application should be hidden from users.
4. Installation for end user must be as easy as possible.
Now I do steps 1-2 using xampp and manually creating shortcut. I was interested in some wrapper, installer which do above steps automatically. But I have no idea about 3rd step.
Regarding item 3, see Can you "compile" PHP code?. This would allow you to develop in PHP and deploy the application via an installer.
There are several installer packages which would allow you to automate these steps, depending on your development environment.
PHP and MySQL require to have a web server running. That means you will need to copy the code over to the client's machine and then run the web server locally still on the client's machine.
If that's what you want, look into the Microsoft IIS Express (here).
In short, IIS is a web server that can host and run a server side web application, written in ASP.NET or PHP.
Here are the steps you need to take:
Install IIS express on the client's machine (one-time process, and I think quite acceptable - treat this as a runtime installation).
Create a designated (hidden) folder for the source files of the web application that you want to deploy (one-time process).
Create a windows batch file (bat or cmd) that starts the IIS (as described here) and then opens the website's URL so that the default browser starts. This file will serve as a shortcut, so you can place it on the desktop or wherever appropriate (one-time process).
Deploy your web application to the hidden folder from step 2 above (repetitive process - deploy to the same folder when you want to upgrade the clients to a new version).
Please have in mind that I am basing my suggestion on your requirement to host and run the application locally (on localhost).
However, if there's an option to run the application on a separate machine (not a localhost), then you could simply place a desktop shortcut to the network or internet address URL that would open the default browser without problems.
i would suggest Pouchdb http://pouchdb.com/api.html and Adobe Air http://www.adobe.com/devnet/air/air-sdk-download.edu.html. This way you can code with html and javascript and package it with Adobe Air.
I'm afraid it's not that simple.
If you want to use this approach (and I highly discourage it), you will have to deploy a webserver of some sorts on the client. You should be able to run the Apache/IIS Express and MySQL/SQLite executable and start a simple webserver and database.
If you'd also like a icon, you can create an installer that creates this icon and points to the URL you wish.
I'm afraid that's not possible. PHP is and always will be a scripting language. You might be able to obfuscate it somehow, but anyone who can download your application will be able to de-obfuscate it.
Again, you can create an installer. Inno Setup is pretty good from what I've heard.

Resources