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.
Related
I want to do demonstrate to the IT area at my work how one might use a container for isolated development. I have installed WSL2, then I have a development container running with some basic developer tools--OpenJDK, etc. I can SSH into the container from a WSL2 terminal simply by running ssh user#172.17.0.2, for example, but I cannot figure out how to SSH into this from Windows. More importantly, I want to be able to SSH into the running container from Visual Studio Code via Windows, but things just seem to time out. Does anybody know how to get this going? I have a very locked-down IT environment and I want to do this without having to install Docker for Windows (which I doubt my IT department will ever approve).
I am trying to develop in a remote container.
I run VS Code on my local windows machine.
I have a linux machine which runs docker and a bunch of containers.
I have the "Remote - Containers" and "Remote - SSH" extensions installed in VS Code.
I can connect to my linux machine in VS Code and I can see the running containers.
I can right click on a container and choose "Attach Shell". This works fine:
When I right click on a container and choose "Attach Visual Studio Code" I get an error:
UPDATE
The above error was raised because (for some reason?) docker must be running locally on windows also even though we are fully on a remote machine. I've installed and run docker locally.
Now when I right click on a running container, I get a different error:
Of course the containers are running -- I see them.
How can I Attach Visual Studio Code to a running remote container successfully?
This may not be a real answer but it's too much for a comment.
I believe you have a local machine and docker on a remote server.
The first thing you have to do is to install docker on your local machine and configure it so that's its looking for the docker host on your remote server.
Then you can create a .devcontainer.json on your machine. If you have the extension installed, VSCode will offer you do open this as container environment. Since your docker host sits on remote, this will now happen on your server instead of your local machine.
When I did the setup, I followed amongst other things this guide. Especially the SSH-Agent was required to get a remote docker host working. https://code.visualstudio.com/docs/remote/containers-advanced#_a-basic-remote-example
Here is a example .devcontainer file of mine.
Now back to your initial question, I don't think you will be able to use the remote container extension on a container that wasn't started as dev container. This is because vscode will install a bunch of stuff in there when its first set up. Similar to the SSH Extension. I may be wrong on this so take it with a grain of salt.
It may also be worth noting that once you connect to your server via SSH and have then the regular docker extension (which is not the remote container extension) installed, on remote, you will see your docker images listed there. But that does not mean you will be able to connect like that from local to remote container. For that you need to configure a docker remote host.
I have also faced similar issue after doing some research I found the issue was with my installation.
But I faced this issue when I installed vs-code through snap in Ubuntu.
May be try uninstalling VS Code and reinstalling it.
It should work if Docker is installed properly.
I was trying Docker Desktop for Windows on a VM with Windows 10 Enterprise evaluation.
This is the error that I get:
I've searched round here but I haven't found nothing usefull. I have opened the log file and found error message like:
Failed to setup server socket listening on hyperv-connect://... Failed
to contact the database on \.\pipe\dockerDataBase.... File not found
Unable to write to database (continue like image above)
Nobody have idea? I've accepted the initial prompt when Docker asks me if I want to enable the Hyper-V feature and restart the computer after activation. Could it be a problem of nested virtualization?
I had the same problem and I solved it after I executed this command on a Powershell window:
bcdedit /set hypervisorlaunchtype Auto
I also had to enable CPU virtualization on the hardware properties of the virtual machine (I'm using VMWare vCenter, that might not be needed in your case)
The problem was the nested virtualization. Docker for Windows use Hyper-V behind the scene, Hyper-V was on the host machine too, so there's two nested virtual machine.
The steps are:
Create virtual machine named Docker (the one where Docker will be installed on) without dynamic memory allocation
Open Powershell and Set-VMProcessor -VMName "Docker" -ExposeVirtualizationExtensions $true
Install SO and Docker for Windows as usual
Be aware host machine and guest machine must share the same build number and both needs to be a Windows 10 or Windows Server 2016.
So I'm playing around with this containers concept and specificlly windows containers.
I managed to run containers using the windows nanoserver image, however this image meant to services and does not support gui applications (or 32 bit apps).
Couldn't find any mentioning of running gui applications (and see there gui) using windows container (found only linux container gui).
is there a way to run GUI apps in containers? and so how do I can create my own image containing this support?
As per my knowledge, its impossible because docker does not allow rdp inside container
The nano server is not supporting GUI. That's why I cannot see how this should work if your base image for your container is a nano server
No, it is not possible on Windows regardless of image. It is a system limitation. As a last hope to get this somehow running I would try to install a VNC server inside a container and would try to connect to it from outside. This approach works for Linux-based containers. But I'm doubting that it will work on Windows.
Copdenvy's shellinabox runner allows you to start a shell in the browser in which you can compile and run your code. This is fine for applications that are console based. Is it possible to run an X Windows application in the cloud and see the graphical window?
Setting the DISPLAY variable in the shell to that of your Linux workstation could work, though it relies on you being in control of the local network for things like NAT and firewall settings. The attraction of the cloud IDE is that you only need a browser and an https connection.
Can you ssh -X into the Docker container from an X capable source? Where would you find the URL? How would you manage the ssh keys?
If you look at the Java/Swing "VNC + Java 7" runner for example you'll see that you're able to run an application which is using X DISPLAY through VNC. Codenvy supplies a web based X Windows environment that you can access by clicking on the hyperlink that is shown underneath the Console window, to the left of the Timeout counter. You can then look at the Docker recipe used to start this sample.
SSH in the docker container could be managed in Codenvy 3.x if you install inside the VM the sshd daemon and export the ssh/22 port. In upcoming Codenvy SaaS 4.x ssh will be enabled without any configuration.