Deepstream docker failed run RTSP demo

Hi I want to test deepstream rtsp demo in docker, I can successfully run in Jetson nano, however in docker I got an error like this > **`Using winsys: x11 **

**    ERROR: Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/../../models/Primary_Detector_Nano/resnet10.caffemodel_b8_gpu0_fp16.engine open error**
**    0:00:04.464693144   220     0x134a9500 WARN                 nvinfer gstnvinfer.cpp:599:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1566> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/../../models/Primary_Detector_Nano/resnet10.caffemodel_b8_gpu0_fp16.engine failed**
**    0:00:04.464813667   220     0x134a9500 WARN                 nvinfer gstnvinfer.cpp:599:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1673> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/../../models/Primary_Detector_Nano/resnet10.caffemodel_b8_gpu0_fp16.engine failed, try rebuild**
**    0:00:04.464875282   220     0x134a9500 INFO                 nvinfer gstnvinfer.cpp:602:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1591> [UID = 1]: Trying to create engine from model files**
**    INFO: [TRT]: Some tactics do not have sufficient workspace memory to run. Increasing workspace size may increase performance, please check verbose output.**
**    INFO: [TRT]: Detected 1 inputs and 2 output network tensors.**
**    0:00:36.279130905   220     0x134a9500 INFO                 nvinfer gstnvinfer.cpp:602:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1624> [UID = 1]: serialize cuda engine to file: /opt/nvidia/deepstream/deepstream-5.0/samples/models/Primary_Detector_Nano/resnet10.caffemodel_b1_gpu0_fp16.engine successfully**
**    INFO: [Implicit Engine Info]: layers num: 3**
**    0   INPUT  kFLOAT input_1         3x272x480       **
**    1   OUTPUT kFLOAT conv2d_bbox     16x17x30        **
**    2   OUTPUT kFLOAT conv2d_cov/Sigmoid 4x17x30         **

**    0:00:36.325363318   220     0x134a9500 INFO                 nvinfer gstnvinfer_impl.cpp:311:notifyLoadModelStatus:<primary_gie> [UID 1]: Load new model:/opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/config_infer_primary_nano.txt sucessfully**

**    Runtime commands:**
**    	h: Print this help**
**    	q: Quit**

**    	p: Pause**
**    	r: Resume**


**    **PERF: FPS 0 (Avg)	**
**    **PERF: 0.00 (0.00)	**
**    ** INFO: <bus_callback:181>: Pipeline ready**

**    Opening in BLOCKING MODE **
**    NvMMLiteOpen : Block : BlockType = 261 **
**    NVMEDIA: Reading vendor.tegra.display-size : status: 6 **
**    NvMMLiteBlockCreate : Block : BlockType = 261 **
**    ** INFO: <bus_callback:167>: Pipeline running**

**    0:00:37.636054016   220     0x12f2c8f0 WARN                 nvinfer gstnvinfer.cpp:1946:gst_nvinfer_output_loop:<primary_gie> error: Internal data stream error.**
**    0:00:37.636127820   220     0x12f2c8f0 WARN                 nvinfer gstnvinfer.cpp:1946:gst_nvinfer_output_loop:<primary_gie> error: streaming stopped, reason error (-5)**
**    ERROR from primary_gie: Internal data stream error.**
**    Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(1946): gst_nvinfer_output_loop (): /GstPipeline:pipeline/GstBin:primary_gie_bin/GstNvInfer:primary_gie:**
**    streaming stopped, reason error (-5)**
**    Quitting**
**    ERROR from osd_queue: Internal data stream error.**
**    Debug info: gstqueue.c(988): gst_queue_handle_sink_event (): /GstPipeline:pipeline/GstBin:processing_bin_0/GstBin:osd_bin/GstQueue:osd_queue:**
**    streaming stopped, reason error (-5)**
**    App run failed**
**    `**

and my source1_rtsp.txt is like this
[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5
#gie-kitti-output-dir=streamscl

[tiled-display]
enable=0
rows=1
columns=1
width=1280
height=720
gpu-id=0
#(0): nvbuf-mem-default - Default memory allocated, specific to particular platform
#(1): nvbuf-mem-cuda-pinned - Allocate Pinned/Host cuda memory, applicable for Tesla
#(2): nvbuf-mem-cuda-device - Allocate Device cuda memory, applicable for Tesla
#(3): nvbuf-mem-cuda-unified - Allocate Unified cuda memory, applicable for Tesla
#(4): nvbuf-mem-surface-array - Allocate Surface Array memory, applicable for Jetson
nvbuf-memory-type=0

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
#uri=file://../../streams/sample_1080p_h264.mp4
uri=rtsp://admin:passw0rd@9.123.143.123:554/h264/main/ch1/main/av_stream
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File
type=2
sync=0
source-id=0
gpu-id=0
qos=0
nvbuf-memory-type=0
overlay-id=1

[sink1]
enable=0
type=3
#1=mp4 2=mkv
container=1
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
#iframeinterval=10
bitrate=2000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
output-file=out.mp4
source-id=0

[sink2]
enable=0
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8554
udp-port=5400

[osd]
enable=1
gpu-id=0
border-width=1
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0

[streammux]
gpu-id=0
##Boolean property to inform muxer that sources are live
live-source=0
batch-size=1
##time out in usec, to wait after the first buffer is available
##to push the batch even if the complete batch is not formed
batched-push-timeout=40000
## Set muxer output width and height
width=1920
height=1080
##Enable to maintain aspect ratio wrt source, and allow black borders, works
##along with width, height properties
enable-padding=0
nvbuf-memory-type=0
## If set to TRUE, system timestamp will be attached as ntp timestamp
## If set to FALSE, ntp timestamp from rtspsrc, if available, will be attached
# attach-sys-ts-as-ntp=1

# config-file property is mandatory for any gie section.
# Other properties are optional and if set will override the properties set in
# the infer config file.
[primary-gie]
enable=1
gpu-id=0
model-engine-file=../../models/Primary_Detector_Nano/resnet10.caffemodel_b8_gpu0_fp16.engine
batch-size=1
#Required by the app for OSD, not a plugin property
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
interval=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_primary_nano.txt

[tracker]
enable=0
# For the case of NvDCF tracker, tracker-width and tracker-height must be a multiple of 32, respectively
tracker-width=480
tracker-height=288
#ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_mot_iou.so
#ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_nvdcf.so
ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_mot_klt.so
#ll-config-file required for IOU only
#ll-config-file=iou_config.txt
gpu-id=0

[tests]
file-loop=0

and i pull docker by instrutions in deepstream-l4t.

Hi,

Have you enabled X11 access to the docker?
It should look like this:

$ xhost +
$ sudo docker run -e DISPLAY=$DISPLAY ...

Thanks.

Yes I run container like this command :
sudo docker run -it --rm --net=host --runtime nvidia -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-5.0 -v /tmp/.X11-unix/:/tmp/.X11-unix -v /tmp/argus_socket:/tmp/argus_socket -v /opt/nvidia/deepstream/deepstream-5.0/sources/python:/opt/nvidia/deepstream/deepstream/sources/python nvcr.io/nvidia/deepstream-l4t:5.0-dp-20.04-samples, while I text xhost, output like this

`zhixing@Jeston-Nano-desktop:~$ xhost +
access control disabled, clients can connect from any host`

Hi,

Please make sure you have a display connects to the Jetson device first.
If yes, please run the following command:

$ export DISPLAY=:1
$ xhost +

Thanks.