I've been trying to dockerize the xeyes app just to test. I know there are other ways to run things in raspberry pi but I needed a self contained image that doesn't rely on the machine's X11. I had to use xvfb to get rid of lots of errors. The VNC itself starts and I can connect, but the screen is black.

It is based on this answer https://stackoverflow.com/a/16311264/6655884

Here's my Dockerfile:

FROM resin/rpi-raspbian:latest

RUN apt-get update && apt-get install -y arduino x11vnc xvfb x11-apps

RUN mkdir ~/.vnc && x11vnc -storepasswd 1234 ~/.vnc/passwd

ENV DISPLAY :1

CMD /usr/bin/Xvfb :1 -screen 0 1366x768x16 & x11vnc -display :1 -forever -usepw -create & sleep 20 && xeyes

I had to add an sleep of 20 seconds to make VNC start before the xeyes, otherwise the dockerfile stops with an error about not being able to connect to display 1.

Here's the output:

23/04/2018 02:32:35 -usepw: found /root/.vnc/passwd
23/04/2018 02:32:35 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 12
23/04/2018 02:32:35 
23/04/2018 02:32:35 wait_for_client: WAIT:cmd=FINDCREATEDISPLAY-Xvfb
23/04/2018 02:32:35 
23/04/2018 02:32:35 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/2560
23/04/2018 02:32:35 
23/04/2018 02:32:35 Autoprobing TCP port 
23/04/2018 02:32:35 Autoprobing selected TCP port 5900
23/04/2018 02:32:35 Autoprobing TCP6 port 
23/04/2018 02:32:35 Autoprobing selected TCP6 port 5900
23/04/2018 02:32:35 listen6: bind: Address already in use
23/04/2018 02:32:35 Not listening on IPv6 interface.
23/04/2018 02:32:35 

The VNC desktop is:      a385d9fbfff3:0
23/04/2018 02:33:35 Got connection from client 172.17.0.1
23/04/2018 02:33:35   other clients:
23/04/2018 02:33:35 Normal socket connection
23/04/2018 02:33:35 incr accepted_client=1 for 172.17.0.1:37900  sock=6
23/04/2018 02:33:35 wait_for_client: got client
23/04/2018 02:33:35 Client Protocol Version 3.8
23/04/2018 02:33:35 Protocol version sent 3.8, using 3.8
23/04/2018 02:33:35 client progressed=1 in 4/0 0.034084 s
23/04/2018 02:33:35 client useCopyRect: 172.17.0.1 0
23/04/2018 02:33:35 client_set_net: 172.17.0.1  0.1560
23/04/2018 02:33:35 wait_for_client: running: env X11VNC_SKIP_DISPLAY=''  /bin/sh /tmp/x11vnc-find_display.DnAxqk
/tmp/x11vnc-find_display.DnAxqk: 1: /tmp/x11vnc-find_display.DnAxqk: netstat: not found
/tmp/x11vnc-find_display.DnAxqk: 1: /tmp/x11vnc-find_display.DnAxqk: xauth: not found
23/04/2018 02:33:36 wait_for_client: find display cmd failed.
23/04/2018 02:33:37 wait_for_client: FINDCREATEDISPLAY cmd: /bin/sh /tmp/x11vnc-find_display.DnAxqk Xvfb
trying N=20 ...
redir_daemon=
/tmp/x11vnc-find_display.DnAxqk: 461: /tmp/x11vnc-find_display.DnAxqk: /tmp/x11vnc-find_display.DnAxqk: 461: /tmp/x11vnc-find_display.DnAxqk: nmerge: not found
-f: not found
/tmp/x11vnc-find_display.DnAxqk: 462: /tmp/x11vnc-find_display.DnAxqk: nmerge: not found
/tmp/x11vnc-find_display.DnAxqk: 462: /tmp/x11vnc-find_display.DnAxqk: -f: not found
/usr/bin/Xvfb :20 -screen 0 1280x1024x24 -cc 4 -nolisten tcp -auth  
use: X [:<display>] [option]
-a #                   default pointer acceleration (factor)
-ac                    disable access control restrictions
-audit int             set audit trail level
-auth file             select authorization file
-br                    create root window with black background
+bs                    enable any backing store support
-bs                    disable any backing store support
-c                     turns off key-click
c #                    key-click volume (0-100)
-cc int                default color visual class
-nocursor              disable the cursor
-core                  generate core dump on fatal error
-displayfd fd          file descriptor to write display number to when ready to connect
-dpi int               screen resolution in dots per inch
-dpms                  disables VESA DPMS monitor control
-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs
-f #                   bell base (0-100)
-fc string             cursor font
-fn string             default font name
-fp string             default font path
-help                  prints message with these options
+iglx                  Allow creating indirect GLX contexts
-iglx                  Prohibit creating indirect GLX contexts (default)
-I                     ignore all remaining arguments
-ld int                limit data space to N Kb
-lf int                limit number of open files to N
-ls int                limit stack space to N Kb
-nolock                disable the locking mechanism
-maxclients n          set maximum number of clients (power of two)
-nolisten string       don't listen on protocol
-listen string         listen on protocol
-noreset               don't reset after last client exists
-background [none]     create root window with no background
-reset                 reset after last client exists
-p #                   screen-saver pattern duration (minutes)
-pn                    accept failure to listen on all ports
-nopn                  reject failure to listen on all ports
-r                     turns off auto-repeat
r                      turns on auto-repeat 
-render [default|mono|gray|color] set render color alloc policy
-retro                 start with classic stipple and cursor
-s #                   screen-saver timeout (minutes)
-seat string           seat to run on
-t #                   default pointer threshold (pixels/t)
-terminate             terminate at server reset
-to #                  connection time out
-tst                   disable testing extensions
ttyxx                  server started from init on /dev/ttyxx
v                      video blanking for screen-saver
-v                     screen-saver without video blanking
-wm                    WhenMapped default backing-store
-wr                    create root window with white background
-maxbigreqsize         set maximal bigrequest size 
+xinerama              Enable XINERAMA extension
-xinerama              Disable XINERAMA extension
-dumbSched             Disable smart scheduling, enable old behavior
-schedInterval int     Set scheduler interval in msec
-sigstop               Enable SIGSTOP based startup
+extension name        Enable extension
-extension name        Disable extension
-query host-name       contact named host for XDMCP
-broadcast             broadcast for XDMCP
-multicast [addr [hops]] IPv6 multicast for XDMCP
-indirect host-name    contact named host for indirect XDMCP
-port port-num         UDP port number to send messages to
-from local-address    specify the local address to connect from
-once                  Terminate server after one session
-class display-class   specify display class to send in manage
-cookie xdm-auth-bits  specify the magic cookie for XDMCP
-displayID display-id  manufacturer display ID for request
[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]
                       enable/disable accessx key sequences
-ardelay               set XKB autorepeat delay
-arinterval            set XKB autorepeat interval
-screen scrn WxHxD     set screen's width, height, depth
-pixdepths list-of-int support given pixmap depths
+/-render          turn on/off RENDER extension support(default on)
-linebias n            adjust thin line pixelization
-blackpixel n          pixel value for black
-whitepixel n          pixel value for white
-fbdir directory       put framebuffers in mmap'ed files in directory
-shmem                 put framebuffers in shared memory
/usr/bin/nohup: failed to run command ‘.xinitrc’: No such file or directory
/tmp/x11vnc-find_display.DnAxqk: 981: /tmp/x11vnc-find_display.DnAxqk: -f: not found
23/04/2018 02:33:44 Using X display :20
23/04/2018 02:33:44 rootwin: 0x43 reswin: 0x200001 dpy: 0x13c58b8
23/04/2018 02:33:44 
23/04/2018 02:33:44 ------------------ USEFUL INFORMATION ------------------
23/04/2018 02:33:44 X DAMAGE available on display, using it for polling hints.
23/04/2018 02:33:44   To disable this behavior use: '-noxdamage'
23/04/2018 02:33:44 
23/04/2018 02:33:44   Most compositing window managers like 'compiz' or 'beryl'
23/04/2018 02:33:44   cause X DAMAGE to fail, and so you may not see any screen
23/04/2018 02:33:44   updates via VNC.  Either disable 'compiz' (recommended) or
23/04/2018 02:33:44   supply the x11vnc '-noxdamage' command line option.
23/04/2018 02:33:44 
23/04/2018 02:33:44 Wireframing: -wireframe mode is in effect for window moves.
23/04/2018 02:33:44   If this yields undesired behavior (poor response, painting
23/04/2018 02:33:44   errors, etc) it may be disabled:
23/04/2018 02:33:44    - use '-nowf' to disable wireframing completely.
23/04/2018 02:33:44    - use '-nowcr' to disable the Copy Rectangle after the
23/04/2018 02:33:44      moved window is released in the new position.
23/04/2018 02:33:44   Also see the -help entry for tuning parameters.
23/04/2018 02:33:44   You can press 3 Alt_L's (Left "Alt" key) in a row to 
23/04/2018 02:33:44   repaint the screen, also see the -fixscreen option for
23/04/2018 02:33:44   periodic repaints.
23/04/2018 02:33:44 
23/04/2018 02:33:44 XFIXES available on display, resetting cursor mode
23/04/2018 02:33:44   to: '-cursor most'.
23/04/2018 02:33:44   to disable this behavior use: '-cursor arrow'
23/04/2018 02:33:44   or '-noxfixes'.
23/04/2018 02:33:44 using XFIXES for cursor drawing.
23/04/2018 02:33:44 GrabServer control via XTEST.
23/04/2018 02:33:44 
23/04/2018 02:33:44 Scroll Detection: -scrollcopyrect mode is in effect to
23/04/2018 02:33:44   use RECORD extension to try to detect scrolling windows
23/04/2018 02:33:44   (induced by either user keystroke or mouse input).
23/04/2018 02:33:44   If this yields undesired behavior (poor response, painting
23/04/2018 02:33:44   errors, etc) it may be disabled via: '-noscr'
23/04/2018 02:33:44   Also see the -help entry for tuning parameters.
23/04/2018 02:33:44   You can press 3 Alt_L's (Left "Alt" key) in a row to 
23/04/2018 02:33:44   repaint the screen, also see the -fixscreen option for
23/04/2018 02:33:44   periodic repaints.
23/04/2018 02:33:44 
23/04/2018 02:33:44 XKEYBOARD: number of keysyms per keycode 7 is greater
23/04/2018 02:33:44   than 4 and 51 keysyms are mapped above 4.
23/04/2018 02:33:44   Automatically switching to -xkb mode.
23/04/2018 02:33:44   If this makes the key mapping worse you can
23/04/2018 02:33:44   disable it with the "-noxkb" option.
23/04/2018 02:33:44   Also, remember "-remap DEAD" for accenting characters.
23/04/2018 02:33:44 
23/04/2018 02:33:44 X FBPM extension not supported.
23/04/2018 02:33:44 X display is not capable of DPMS.
23/04/2018 02:33:44 --------------------------------------------------------
23/04/2018 02:33:44 
23/04/2018 02:33:44 Default visual ID: 0x21
23/04/2018 02:33:44 Read initial data from X display into framebuffer.
23/04/2018 02:33:44 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/5120
23/04/2018 02:33:44 rfbNewFramebuffer(0x13b66c0, 0x0, 1280, 1024, 8, 1, 4)
23/04/2018 02:33:44 Pixel format for client 172.17.0.1:
23/04/2018 02:33:44   32 bpp, depth 24, little endian
23/04/2018 02:33:44   true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
23/04/2018 02:33:44 
23/04/2018 02:33:44 X display :20 is 32bpp depth=24 true color
23/04/2018 02:33:44 
23/04/2018 02:33:44 calling setTranslateFunction()...
23/04/2018 02:33:44 Pixel format for client 172.17.0.1:
23/04/2018 02:33:44   32 bpp, depth 24, little endian
23/04/2018 02:33:44   true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
23/04/2018 02:33:44 no translation needed
23/04/2018 02:33:44   done.
23/04/2018 02:33:44 TS_REDIR is empty, restarting...
23/04/2018 02:33:44 
23/04/2018 02:33:44 Xinerama is present and active (e.g. multi-head).
23/04/2018 02:33:44 Xinerama: number of sub-screens: 1
23/04/2018 02:33:44 Xinerama: no blackouts needed (only one sub-screen)
23/04/2018 02:33:44 
23/04/2018 02:33:44 fb read rate: 59 MB/sec
23/04/2018 02:33:44 The X server says there are 10 mouse buttons.
23/04/2018 02:33:44 screen setup finished.
23/04/2018 02:33:44 

The VNC desktop is:      a385d9fbfff3:0

******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching

23/04/2018 02:33:44 rfbProcessClientSecurityType: executing handler for type 2
23/04/2018 02:33:44 Battling with something for -norepeat!! (1 resets left)
23/04/2018 02:33:44 Disabled X server key autorepeat.
23/04/2018 02:33:44   to force back on run: 'xset r on' (2 times)
23/04/2018 02:33:44 created   xdamage object: 0x20002c
23/04/2018 02:33:51 cutbuffer_send: no send: uninitialized clients
23/04/2018 02:34:25 client useCopyRect: 172.17.0.1 0
23/04/2018 02:34:25 Pixel format for client 172.17.0.1:
23/04/2018 02:34:25   8 bpp, depth 8
23/04/2018 02:34:25   true colour: max r 7 g 7 b 3, shift r 0 g 3 b 6
23/04/2018 02:34:25 rfbProcessClientNormalMessage: ignoring unsupported encoding type ultraZip
23/04/2018 02:34:25 Using compression level 9 for client 172.17.0.1
23/04/2018 02:34:25 Using image quality level 0 for client 172.17.0.1
23/04/2018 02:34:25 Using JPEG subsampling 1, Q15 for client 172.17.0.1
23/04/2018 02:34:25 Enabling X-style cursor updates for client 172.17.0.1
23/04/2018 02:34:25 Enabling full-color cursor updates for client 172.17.0.1
23/04/2018 02:34:25 Enabling cursor position updates for client 172.17.0.1
23/04/2018 02:34:25 Enabling KeyboardLedState protocol extension for client 172.17.0.1
23/04/2018 02:34:25 Enabling NewFBSize protocol extension for client 172.17.0.1
23/04/2018 02:34:25 Enabling LastRect protocol extension for client 172.17.0.1
23/04/2018 02:34:25 Enabling SupportedMessages protocol extension for client 172.17.0.1
23/04/2018 02:34:25 Enabling SupportedEncodings protocol extension for client 172.17.0.1
23/04/2018 02:34:25 Enabling ServerIdentity protocol extension for client 172.17.0.1
23/04/2018 02:34:25 Enabling Xvp protocol extension for client 172.17.0.1
23/04/2018 02:34:25 Using tight encoding for client 172.17.0.1
23/04/2018 02:34:30 created selwin: 0x20002d
23/04/2018 02:34:30 called initialize_xfixes()
  • Could you paste your docker run or docker execcommand, please? Maybe there's a problem with privileges. Have you tried to launch container with --privileged option? – Alex Galera May 9 at 8:12
  • This article might help. – harrymc May 10 at 18:51

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.