Search code examples
ruser-interfacedockerdockerfiledocker-build

Using X11-forwarding for Docker containers


I am trying to build a Dockerfile which contains an Rscript through Docker run. I am facing an error related to tcl/tk package loading while building it for which I want to use X-11 forwarding and Display variable while building the docker file. I am currently following this post. The problem that I am facing is that I cannot find tmp/.X11-unix directory in my machine as mentioned in the post. Is there any alternative for this for building docker file and to overcome the errors in tcl/tk package?


Solution

  • i ran the docker with the following statements and it solved the solution. The tcl/tk library needs a GUI to load itself so you need to set up an environment.

    docker run -ti --rm \
       -e DISPLAY=$DISPLAY \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
      44589772e33b