Docker Community Forums

Share and learn in the Docker community.

Problrm to use graphics inside docker

This is my docker file to use Coppelia (Robotics Simulator), when launch it by ./coppeliasim.sh -h , the docker has problem to launch that application because of qt5 in ubuntu 20.04

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, webgl, xcb.

./coppeliaSim.sh: line 35:  2253 Aborted                 (core dumped) "$dirname/$appname" "${PARAMETERS[@]}"
root@ros:/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04# exit
ERRO[0487] error waiting for container: unexpected EOF  

FROM nvidia/cudagl:11.0-devel-ubuntu20.04

ARG DEBIAN_FRONTEND=noninteractive

# linux
RUN apt-get update
RUN apt-get install apt-utils -y 
RUN apt-get install git  -y 
RUN apt-get install wget  -y 
RUN apt-get install xz-utils  -y 
RUN apt-get install build-essential  -y 
RUN apt-get install linux-libc-dev  -y 
RUN apt-get install libusb-1.0-0  -y 
RUN apt-get install build-essential  -y 
RUN apt-get install python3-pip  -y 
RUN apt-get install screen  -y 
RUN apt-get install psmisc  -y 
RUN apt-get install nano  -y 
# Coppelia dependencies
RUN apt-get install libglib2.0  -y 
RUN apt-get install libgl1-mesa-glx  -y 
 # Eigen
RUN apt-get install libeigen3-dev  -y 
 # Boost 
RUN apt-get install libboost-all-dev  -y 
# OpenCv
RUN  apt-get install libopencv-dev  -y 
RUN  apt-get install python3-opencv  -y 
# PCL depenedencies
RUN apt-get install libflann-dev  -y 
RUN apt-get install libomp-dev  -y 
RUN apt-get install libvtk6-dev  -y 
RUN apt-get install xsltproc  -y 

WORKDIR /

RUN wget https://coppeliarobotics.com/files/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz

RUN apt-get remove -y wget

RUN tar -xf CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz

RUN apt-get remove -y xz-utils

RUN rm CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz

WORKDIR /CoppeliaSim_Edu_V4_1_0_Ubuntu20_04

Do anyone has experience in that?

There are a few different options to run GUI applications inside a Docker container like using SSH with X11 forwarding, or VNC but the simplest one that I figured out was to share my X11 socket with the container and use it directly.