How to fix X Error: BadAccess, BadDrawable, BadShmSeg while running graphical application using Docker?
You can set the option --ipc=host
to enable the docker container to communicate with host processes and also accessing the shared memories .
The command to launch graphical application will look as follows:
docker run --ipc=host -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --user="$(id --user):$(id --group)" ubuntu:freemat
and will show the application window:
MIT_SHM is actually an extension for passing the XImages and some Pixmaps via shared memory. So if the container cannot access that , you cannot open almost any graphical application.
And if you're concerned with the security , you can use --cap-drop
to drop some capabilities as stated here.