docker-firefox icon indicating copy to clipboard operation
docker-firefox copied to clipboard

How do I use this with a VNC client?

Open adelevie opened this issue 11 years ago • 5 comments

How would I connect to this server with something like Chicken of the VNC?

[ip]:[port] is not connecting. Even with 1234 as the password.

adelevie avatar Jul 30 '13 01:07 adelevie

First, you need to check the port allocated (by doing docker inspect or simply docker ps, then you connect to your host's ip with the port you just found.

If you are using OSX, you probably want to use the native VNC client (within finder, 'Go' menu, 'Connect to server' then vnc://<ip>:<port>

creack avatar Jul 30 '13 01:07 creack

FYI if you're using current boot2docker 0.8 / docker 0.10 on OSX, you have to map the port exposed on the boot2docker-vm to your localhost machine as described in https://github.com/boot2docker/boot2docker/issues/58.

$ boot2docker stop
$ CFWPORTS=""
for ip in {49000..49900}
    do
        CFWPORTS="$CFWPORTS --natpf1 zfp$ip,tcp,127.0.0.1,$ip,,$ip"
    done
VBoxManage modifyvm boot2docker-vm $CFWPORTS
$ boot2docker start
$ docker run -d --name firefox -p 5900 creack/firefox-vnc x11vnc -forever -usepw -create
$ docker ps
59f424bd3f6c        creack/firefox-vnc:latest   x11vnc -forever -use   4 minutes ago       Up About a minute   0.0.0.0:49156->5900/tcp
$ open vnc://127.0.0.1:49156

jamshid avatar May 04 '14 23:05 jamshid

Hello all, really appreciative to have so much help online.

I'm using using Docker Toolbox on a Windows 7 Home host machine and haven't yet got this to work. I did however resolve an intermediate issue and wanted to share so that you might be able to help someone else get to the point I am at.

The stackexchange resource, https://stackoverflow.com/questions/16296753/can-you-run-gui-apps-in-a-docker-container# , suggests this:

docker run -p 5900 -e HOME=/ creack/firefox-vnc x11vnc -forever -usepw -create

and the comments therein further suggests adding the -t switch. This resulted in the 'enter pswd' prompt in the terminal but didn't actually accept any input, So I thought to also add the -i switch.

This accepted the password and resulted in the subsequent prompts. Here's the output from my terminal:

> $ docker run -t -i -p 5900 -e HOME=/ u16-vnc-ff x11vnc -forever -usepw -create

Enter VNC password: Verify password: Write password to //.vnc/passwd? [y]/n y Password written to: //.vnc/passwd 16/08/2017 15:58:32 x11vnc version: 0.9.13 lastmod: 2011-08-10 pid: 1 16/08/2017 15:58:32 16/08/2017 15:58:32 wait_for_client: WAIT:cmd=FINDCREATEDISPLAY-Xvfb 16/08/2017 15:58:32 16/08/2017 15:58:32 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/2560 16/08/2017 15:58:32 16/08/2017 15:58:32 Autoprobing TCP port 16/08/2017 15:58:32 Autoprobing selected TCP port 5900 16/08/2017 15:58:32 Autoprobing TCP6 port 16/08/2017 15:58:32 Autoprobing selected TCP6 port 5900 16/08/2017 15:58:32 listen6: bind: Address already in use 16/08/2017 15:58:32 Not listening on IPv6 interface. 16/08/2017 15:58:32

The VNC desktop is: 26db77836b7d:0 PORT=5900

Unfortunately when I open up my VNC Desktop Client, UltraVnc Viewer, and try to connect to 192.168.99.100:5900 I receive a failed connection attempt.

Any advice?

PS: I couldn't update / comment on stackexchange because I don't have a reputation there... I am a noob.

namelus avatar Aug 18 '17 02:08 namelus

@namelus This is because Docker does NAT by default. When you do -p 5900 docker will open a random port on the Docker VM and map it to 5900.

2 solutions:

  1. Use -p 5900:5900 to force docker to use 5900 on the outside as well
  2. Do docker port <CONTAINER NAME/OD> 5900 to see the random port allocated by docker and use that.

creack avatar Aug 18 '17 13:08 creack

Guillaume - That did the trick! Once again - thanks for the assist.

On Fri, Aug 18, 2017 at 9:56 AM Guillaume J. Charmes < [email protected]> wrote:

@namelus https://github.com/namelus This is because Docker does NAT by default. When you do -p 5900 docker will open a random port on the Docker VM and map it to 5900.

2 solutions:

  1. Use -p 5900:5900 to force docker to use 5900 on the outside as well
  2. Do docker port <CONTAINER NAME/OD> 5900 to see the random port allocated by docker and use that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/creack/docker-firefox/issues/1#issuecomment-323360524, or mute the thread https://github.com/notifications/unsubscribe-auth/AKsc2BxCmGv_xmSBfT--3z4ASDvsSn0uks5sZZf0gaJpZM4A22Hd .

namelus avatar Aug 19 '17 20:08 namelus