I want to use wineconsole via docker in CENTOS7
I've pull this image via these commands :
docker pull masonr/wineconsole
docker run -i -t masonr/wineconsole
and when run wineconsole
it said :
wineuser#X:~$ wineconsole
0050:err:winediag:nodrv_CreateWindow Application tried to create a
window, but no driver could be loaded.
0050:err:winediag:nodrv_CreateWindow Make sure that your X server is
running and that $DISPLAY is set correctly.
0050:err:systray:initialize_systray Could not create tray window
00e0:err:winediag:nodrv_CreateWindow Application tried to create a
window, but no driver could be loaded.
00e0:err:winediag:nodrv_CreateWindow Make sure that your X server is
running and that $DISPLAY is set correctly.
The x11 forwarding is enabled through ssh MobaXtrem and I've tried to run xeyes as a prof of concept.
Do I need to run Xserver manually and why it's needed for winconsole ?
Related
I have two machines,
machine A: system ubuntu 20.04 (DISPLAY :0)
machine B: system windows 10
in machine A, I create a docker container with the following command:
docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v $(pwd):/home/walid/notebooks opencv bash
the docker container has Visual Studio Code installed and OpenCV, I run the following command to go in the container bash:
docker exec -it $containerId bash
inside the container, I go into the folder notebooks and run the following commands:
code . # to launch the visual studio code
result; the visual studio code opens
python read.py # to open a video capture with OpenCV
result; good the video capture opens
now int the machine B; I use the Remote Desktop Connection to machine B, when I go inside the container to open Visual Studio Code nothings happing doesn't open, when I try python read.py I get an error could not connect to display :10.0
I figure out where I was doing it wrong:
(base) adminsst#admins:~$ xhost
access control enabled, only authorized clients can connect
SI:localuser:adminsst
(base) adminsst#admins:~$ sudo su
root#admins:/home/adminsst# xhost
No protocol specified
xhost: unable to open display ":10.0"
whene I was runing the container in the sudo su it doesn't work, but when I sudo docker run .... it works.
but now when I login to another user in the server (machine A) and do the same think it doesn't work anymore and I will get the same error could not connect to display :11.0
SOLUTION 1
here's the solution I did and it works for me:
first if you run the following command in the new user you will get:
walid#admins:~$ xhost
access control enabled, only authorized clients can connect
now run the this one again to have this result:
walid#admins:~$ xhost +local:
non-network local connections being added to access control list
to launch the GUI app you need to pass the new DISPLAY to the container because it will had been changed every time you login to solve this problem just run the following command:
walid#admins:~$ sudo docker exec -it -e DISPLAY=$DISPLAY open bash
that's all now you will be able to launch the GUI app without any problem, but still every time you login you should exect the following command xhost +local: before starting the container, if someone has a solution for that please let me know
SOLUTION 2
see the following url here
xhost +local:`docker inspect --format='{{ .Config.Hostname }}' $containerId`
docker start $containerId
there more useful solutions
--------
Another thing I have faced, that even when I do the above steps, sometimes doesn't work, I simply change the display ID in the docker container to the same as Local machine ID by the following;
first figure out the local machine display ID by
echo $DISPLAY
then in the docker container do the following
$DISPLAY=:ID
In my CentOS server I use docker created a container,
I opened two sessions connected to the container by command:
docker attach container-name
but there is an issue, in each window I execute command the other window is display the same information.
so I cannot control the container when it is installing package.
is it possible to avoid this issue?
The docker attach command attaches to the currently running process as defined by CMD. You can attach as many times as you want, but they all connect to the same process.
If you want to access the container and have different sessions to it, use:
docker exec -it container-name bash
Or whatever shell is available. bash is common, but you may need to use sh or find out what's used, if any is there at all. Some containers are super stripped down.
The -it flag enables "interactive" mode, as otherwise it just runs that command and shows you the output.
On my OSX, I can show a gui interface from a docker container successfully with Xqautz as the following command:
docker run -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=$DISPLAY --privileged -ti MY_OWN_DOCKER_IMAGE bash
However, I would like to put MY_OWN_DOCKER_IMAGE inside a docker-machine(called default) and show the gui interface on my OSX.
My scenario like below:
Execute a gui application inside a container running inside default VM.
pass GUI view from container to default VM.
pass GUI view from default VM to OSX.
GUI interface show on my macbook !
I got a question here: how do I set the "-v" and "-e" parameters when I am trying to do "docker run MY_OWN_DOCKER_IMAGE" inside default VM? or is there any other solution?
I found solution here: X11 forwarding doesn’t work when image runs in docker machine but it works fine if the image is run w/o a docker machine
-v should be like : -v /var/run/docker.sock:/var/run/docker.sock
but -e DISPLAY should be given an ip(check it from XQuartz with command "xhost")
Now I can show gui interface from container running in a docker machine VM!
As an evolution on can you run GUI apps in a docker container, is it possible to run GUI applications via Docker without other tools like VNC or X11/XQuartz?
In VirtualBox, you could pass the --type gui to launch a headed VM, and this doesn't require installing any additional software. Is anything like that possible via Dockerfile or CLI arguments?
Docker doesn't provide a virtual video device and a place to render that video content in a window like a VM does.
It might be possible to run a container with --privileged and write to the Docker hosts video devices. That would possibly require a second video card that's not in use. The software that Docker runs in the container would also need to support that video device and be able write directly to it or a frame buffer. This limits what could run in the container to something like an X server or Wayland that draws a display to a device.
You could try the following which is worked in my case.
Check the Local machine display and its authentication
[root#localhost ~]# echo $DISPLAY
[root#localhost ~]# xauth list $DISPLAY
localhost:15 MIT-MAGIC-COOKIE-1 cc2764a7313f243a95c22fe21f67d7b1
Copy the above authentication and join your existing container, and add the display autherntication.
[root#apollo-server ~]# docker exec -it -e DISPLAY=$DISPLAY 3a19ab367e79 bash
root#3a19ab367e79:/# xauth add 192.168.10.10:15.0 MIT-MAGIC-COOKIE-1 cc2764a7313f243a95c22fe21f67d7b1
root#3a19ab367e79:/# firefox
I'm running a docker toolbox installed on my Windows 7 computer, I'm trying to access the docker from outside (win desktop) so I can get a GUI App working (let say we will test with Firefox)
As you all know, docker does not come with Server X, so I've found the solution is to install xcygwin to perform X11 tasks and then run the container via ssh so it could be displayed on my Windows.
The problem is I cant set the display right, I do:
export DISPLAY=:0.0
And tried few other options like exporting to the IP of the host, exporting to localhost etc.. then I SSH into my docker by running:
docker-machine ssh default -X
(the -X supposed to activate the x11 forwarding if I'm not wrong)
Now, I get into my docker, so simply I try to run my magic firefox container by running something like this:
docker run --rm -e DISPLAY=$DISPLAY devurandom/firefox
I get the expected Error: cannot open display.
Right! I didnt set the display in my docker! so I did :
DOCKER=0.0
I get Cannot open display: 0.0!
I also tried this one which I couldnt figure where the Path is comming from but well..
docker run -ti -v /tmp/serverX:/tmp/ServerX -e DISPLAY=$DISPLAY ...
No luck, does anyone know how to fix this?