Docker container GUI ovxio

I made a container where I installed OpenCV and loaded the VisionWorks folder,
I wanted to simply read a image and show it on Display Host using ovxio, here is the code:

#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <memory>

#include <NVX/nvx.h>
#include <NVX/nvx_timer.hpp>

#include <NVX/Application.hpp>
#include <NVX/ConfigParser.hpp>
#include <OVX/FrameSourceOVX.hpp>
#include <OVX/RenderOVX.hpp>
#include <NVX/SyncTimer.hpp>
#include <OVX/UtilityOVX.hpp>
#include "NVX/nvx_opencv_interop.hpp"

#include <opencv2/core/mat.hpp>
#include <opencv2/imgcodecs.hpp>
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/calib3d.hpp"

static void VX_CALLBACK logCallback(vx_context context, vx_reference ref, vx_status status, const vx_char message[])
    printf("[NVX LOG] context=" VX_FMT_REF ",ref=" VX_FMT_REF ",status=%d : %s \n", context, ref, status, message);
int main(int argc, char* argv[])

    ovxio::ContextGuard context;
    vxDirective(context, VX_DIRECTIVE_ENABLE_PERFORMANCE);
    vxRegisterLogCallback(context, logCallback,vx_false_e);
    std::unique_ptr<ovxio::Render> renderer(ovxio::createDefaultRender(context,"Stereo Matching ", (vx_uint32)2560/2, (vx_uint32)1440));
    if (!renderer)
        std::cerr << "Error: Can't create a renderer" << std::endl;
        return nvxio::Application::APP_EXIT_CODE_NO_RENDER;

    cv::Mat frame_left = cv::imread("imgLeft.png",cv::IMREAD_COLOR);
    vx_image gray_left = nvx_cv::createVXImageFromCVMat(context, frame_left);

command launch container:

xhost +si:localuser:root
docker run --network host -it --rm -e DISPLAY=$DISPLAY  -v /tmp/.X11-unix/:/tmp/.X11-unix sa/vision-light:1.0


Error: Can’t create a renderer

by removing the if control the error is:

Segmentation fault (core dumped)

if I use OpenCV with imshow from the container I can get the image on the host


Guess this issue comes from VisionWorks itself rather than docker.
Could you try the app directly on the device to see if the same error occurs?

Error: Can’t create a renderer


trying the same code on the device works.

Perhaps when loading the libraries on the container something is missing for VisionWorks? When I compile the project it does not give me link errors.

what if to use the docker --privileged
argument? that is less secure though thus not adviseable for frequent use, unless specifically required

just launch the container with the parameter --privileged?

sudo docker run --privileged [image_name]

no it does not work the same with --privileged


After internal checking, this is a known issue but does not have a solution or workaround yet.

We already pass your problem to our internal team again.
Will let you know once we got any feedback.


Fine, I look forward to an update from you.
Thank you