I made a Java application in the past for Windows which performs some scientific analysis. This scientific analysis was done by executing a Python script in a Docker container because it required dependencies that were hard to install on Windows.
The GUI application uses Powershell to launch Docker Toolbox in the background which is then used to execute the Python script. My application then waits for the results by checking for the output file's existence.
I was wondering if there was a better way to do this (develop a Windows application that uses Docker containers to run certain code). Any suggestions for technologies that I may consider is appreciated.
TLDR: What's the best way to develop a Windows GUI application that requires some background processing with Docker container?
Related
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.
I have a Windows VM with a desktop application on it. I want to write an agent which will interact with this application through UI automation (via WinAppDriver). The agent should start with the machine and require as little human intervention as possible to do its job.
It's easy enough to get this working by adding it to startup programs (shell:startup), but this requires someone logging into the VM every time it is restarted. Is it possible to run such a program as a Windows Service? Keep in mind it would have to launch a Win32 app and interact with it via UI automation. Could this be done by running it as Local System account and enabling "Allow service to interact with desktop"? Or would it need to run as a specific user account?
No, it is because Windows Service runs in background and to access the UI the process should run foreground.
We need to distribute a tool which is developed using Python, Java and MySQL as database in a distributable format.
So if end user is installing our tool, we check for Python, and if it not exists then we would install Python from the disk and not from apt-get. The process repeats for Java and MySQL which are run as sub-process, so that everything happens in sequence.
We could have used Docker images, but it runs in a container and we would not like our application to run within a restricted environment. Is this understanding correct that we would not have complete access to 100% of the resources in case of Docker?
What should be our approach and if anybody can share their experience in creating such distributable would be highly appreciated.
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.
I am trying to deploy nodejs in a windows environment. As far as I can see nodejs is just a standard application run through the command-line. However running it that way is not very practical in a server environment. Is there a way to run it as a windows service, so you get all the benefits of controlling the execution as you have with other services? I found similar forum entries about this subject, however they are all related to running nodejs in a linux environment, how would you go about doing this in a window environment?
Nodejs application is not like mongodb, redis, nginx ... It's not supposed to run as an os service.
As a best practice, people usually use a process management tool like pm2 to run production nodejs applications. You can give it a try by creating a deploy.sh or deploy.bat as an execution file which trigger pm2 command to start or restart the application.