0

I am trying to follow the following dockerfile to create a container with qtCreator and run the container with the following command

docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix qtcreator

however this is throwing an error as below

PS D:\Docker\qtcreator> docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix qtcreator
QXcbConnection: Could not connect to display 
Aborted

I tried to change the file a bit that looks as below based on some research I did to install VNC on this container.

FROM ubuntu:14.04

# Install vnc, xvfb in order to create a 'fake' display and qtcreator

RUN apt-get update && apt-get install -y qtcreator x11vnc xvfb

run     mkdir ~/.vnc
# Setup a password
run     x11vnc -storepasswd 1234 ~/.vnc/passwd


RUN export uid=1000 gid=1000 && \
    mkdir -p /home/developer && \
    echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
    echo "developer:x:${uid}:" >> /etc/group && \
    echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
    chmod 0440 /etc/sudoers.d/developer && \
    chown ${uid}:${gid} -R /home/developer


USER developer
ENV HOME /home/developer
CMD /usr/bin/qtcreator

after this I tried to run this container using the following command

docker run -p 5900 -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix qtcreator x11vnc -forever -usepw -create

this command seams to run and wait for termination I think, as the PS does not return back.

as I am new to docker can some one please let me know how to connect my VNC Client on my windows 10 parent machine or from a remote machine to the vnc server running in this container. i.e. how do I find the IP Address and port number to connect.

UPDATE 1

when i run the command docker ps --filter "status=running" I see the following log

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
a2ab1397bb2b        qtcreator           "x11vnc -forever -..."   About an hour ago   Up About an hour    0.0.0.0:32770->5900/tcp   clever_haibt
69754e382042        qtcreator           "x11vnc -forever -..."   2 hours ago         Up 2 hours                                    priceless_hugle
Kiran
  • 2,997
  • 6
  • 31
  • 62
  • If you pass Display and X11 socket then you should not be running x11vnc. Also if you pass display then the server should have a active Display. Is that the case or not? – Tarun Lalwani Sep 30 '17 at 06:27
  • @TarunLalwani : can you please help me with a command that uses x11vnc in this case? I am unable to find an answer for the same. Thanks – Kiran Oct 03 '17 at 14:44

0 Answers0