Using VNC with Docker

17,515

Maybe this thread about running GUI applications in docker might help you out? It should be possible and the top answer shows how it should be done.

Alternatively there is this tutorial which seems to do the same thing, but is explained a little more in depth.

Share:
17,515
Andrew Shen
Author by

Andrew Shen

Updated on June 04, 2022

Comments

  • Andrew Shen
    Andrew Shen almost 2 years

    this is my first time using VNC and docker. I want to connect to my docker's GUI.

    I have tried to follow a few tutorials online but my VNC viewer cannot connect to the display. I have exposed port 5900 in my dockerfile, and inside docker I have ran Xvbf :1 -screen 0 1600x1200x16 & export DISPLAY=:1 and x11vnc. It seems to work and I get message saying that the desktop is at port 5900. However I still cannot connect to localhost:5900 in my vnc viewer.

    What am I doing wrong, and what can I use to diagnose my problem? Thanks!

    • Paolo
      Paolo almost 4 years
      Did you bind the port when launching the container (-p) ?
    • David Maze
      David Maze almost 4 years
      Containers don't typically run interactive desktop applications. If you start running a VNC server, and a GNOME login, and a full desktop environment, you're stepping a little outside the "lightweight packaging around a single process" model, and a full VM running a standard desktop OS might be a better match.
    • Andrew Shen
      Andrew Shen almost 4 years
      I have used the -p option. As to the other comment, yes I should probably look to a VM, but I did not write the docker image and are afraid of messing up some system dependencies.
    • StayOnTarget
      StayOnTarget almost 3 years
      I’m voting to close this question because it has nothing to do with programming