简体   繁体   中英

How to show a gui view from a docker container within a docker-machine on OSX?

On my OSX, I can show a gui interface from a docker container successfully with Xqautz as the following command:

docker run -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=$DISPLAY --privileged -ti MY_OWN_DOCKER_IMAGE bash

However, I would like to put MY_OWN_DOCKER_IMAGE inside a docker-machine(called default) and show the gui interface on my OSX.

My scenario like below:

  1. Execute a gui application inside a container running inside default VM.
  2. pass GUI view from container to default VM.
  3. pass GUI view from default VM to OSX.
  4. GUI interface show on my macbook !

I got a question here: how do I set the "-v" and "-e" parameters when I am trying to do "docker run MY_OWN_DOCKER_IMAGE" inside default VM? or is there any other solution?

I found solution here: X11 forwarding doesn't work when image runs in docker machine but it works fine if the image is run w/oa docker machine

-v should be like : -v /var/run/docker.sock:/var/run/docker.sock

but -e DISPLAY should be given an ip(check it from XQuartz with command "xhost")

Now I can show gui interface from container running in a docker machine VM!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM