Running Docker containers on a chrome extension - docker

I'm coding a chrome extensions (mostly HTML, CSS and JS) and I need an application (that runs on Linux) to connect to the internet and feed some data to the extension's JS scripts. On my machine I'm able to setup and run the app in a Docker container smoothly and I'm wondering whether it's possible to incorporate this container into the chrome extension.

Related

Running tests in a visible Chrome window (headful Chrome?) with Jest and Puppeteer inside Docker inside WSL

I've got a pretty elaborate end-to-end test suite driven by Jest and Puppeteer.
Puppeteer can be started Chrome in headless or headful mode:
puppeteer.launch({ headless: false });
I've dockerized the app and the test suite. It's running perfectly in headless mode, but I've lost the ability to run it in headful mode: my headful Chrome is on the Windows host, and my Puppeteer is in Docker in WSL, where a headless Chrome is installed.
How do I use host OS Chrome in headful mode when running Puppeteer tests in Docker?
In a different project, I've had a test suite start a dev server, offer an URL. I could open that URL in the host OS Chrome, and tests would run there. But Puppeteer seems more elaborate than that.
PS Homework
This SO question links to this article that suggests starting a window manager inside the Docker container and connecting to it remotely in a VNC fashion. I don't like that, I want to use the actual Chrome app in my host OS (or any browser, for that matter).
Another SO question, answer suggests the same approach, and here are VNC instructions.
The solution is really simple.
Remote debugging
Add the "--remote-debugging-port=9222" to {args: []} that you pass into puppeteer.launch().
Launch.
Open chrome://inspect in Chrome on your host OS and wait for an entry to appear.
Use the Inspect button/link.
You'll see a normal Chrome window with devtools and a page, except the page will be rendered in VNC style (remote desktop style): the viewport will be sized according to Puppeteer settings and scaled to fit your screen.

Can we debug .NET desktop apps in Docker container

(The more I dig this, the more confusing it gets. I have found Windows images available to download, but none of them appears to be the standard desktop OS)
Is there a way to debug my .NET Framework or .NET Core/5/6 desktop application (WinForms, WPF, VSTO) in a Docker container running Windows 10? I'm just trying to setup a playground environment that I could put together quickly and test my code.
For my own notes and any future beginner, here is my current finding:
Docker is not a full-fledged virtual machine like what we get with VirtualBox, VMWare etc. It's more like a process in an isolated environment, called a Container. For example you could create a container that runs an instance of MySQL, or a container that runs an instance of NodeJS. Of course there are images containing Operating System too, such as Ubuntu, Alpine or even Windows, but those images do not contain the full desktop environment; they are just the base OS services.
So answering the question, no, this is not (currently?) possible at least for Windows. People have had success running Ubuntu desktop inside a Docker container, but that is an advanced topic and only works in Linux-based containers. I haven't seen anything like that for Windows.

How to install extension in firefox automatically?

I have the need to be able to install an extension that I made myself for Firefox in Ubuntu, but without a graphic terminal. I need to be able to install the extension without the need for user interaction.
I want to do this because I am working with Docker and I do not have a graphical interface to be able to interact with my Ubuntu-based container. And therefore I cannot use beyond commands to interact with Ubuntu in my Docker container.
I'm trying to use the Firefox command:
firefox -install-global-extension /path/to/extension
But it also requires user interaction so that it can accept the installation of the extension.
I found this post but I do not understand how to make the installation automatic, because loading the .xpi file to the folder with the extensions does not install in Firefox.

Cannot launch GUI program on Docker container on remote server

My working machine in the office is Ubuntu 18.04, and I have installed a Docker container in this machine. Everything works fine, and I can use Graphic User Interface (GUI) programs such as Firefox and PyCharm in the Docker container. When I works at home, I use my Windows 10 notebook, and in order to connect my working machine in the office, I use X2Go program. With this program, I can remotely connect the machine in my office with GUI. I can also run GUI programs remotely. However, when installed Docker container once again remotely, I cannot use GUI programs in the Docker container. The reason is because in order to let the Docker container access host machine's GUI, I use xhost + command. However, when running this command remotely, I received the following error:
# xhost: must be on local machine to enable or disable access control.
If I ignore this error message, I cannot launch any GUI programs on the Docker container. Any ideas? Thanks.
This article may help:
https://www.ibm.com/support/pages/remote-install-websphere-application-server-unix-host
In the article:
If the remote host is not authorized to connect, you can add it to the
list of authorized clients using the following command:
xhost +
xhost: must be on local machine to enable or disable access control.
This indicates that this command is only authorized from a local
console (For example, not within a telnet session).
Next, you must export the display so that GUI screens generated on the
remote host will be displayed on the local host. To do this, run the
following command on the remote host while logged in through the
telnet session from the local host:
export DISPLAY=
Also your Remote Desktop protocol could be an issue.
X2Go uses NX protocol with SSH for security.
NX protocol uses a caching technology which may be part of the the problem. Remote desktop technologies can vary the experience and may not work with docker GUI remotely.
I have had similar issues with remote desktop technologies (RDP, VNC etc) where some or all of the desktop experience is not visible.
I suggest to try a VNC (RFB protocol) software and see if that works. RDP is another solution.
Be aware VNC and RDP are not by default very secure unless you use a tunneling solution (VPN etc) and encryption. There are VNCs with built in encryption (via SSH) and RDP has security solutions also, but if you are accessing it from home to work you should make sure your security manager is aware of the technology you choose that works for you.

GUI in docker application

I have a desktop application written completely in C with GUI written in Gtk. Currently, it works fine on my Ubuntu desktop.
Now, I want to use the application independent of the OS. Therefore, Docker seems to help with it but as far as I know, it only provides web based UI.
How can I use Docker to deploy standalone desktop applications?
Is there any other container which does the job?
P.S.: The application is written in Gtk 2 hence I cannot use broadway.
I haven't done it myself anytime but just suggesting what might seem obvious.
You can try this though:
Run XVNC server inside the container
Expose the port at which XVNC runs
Connect to the XVNC server from the host machine
Trigger your gui application from within the XVNC console

Resources