If you do not use a web-based IDE (like RStudio Server, Jupyter, VSCode, etc.) with integrated graphics devices, the following additional configuration is required to display plots of R running in your container.
1 The httpgd
R package
httpgd
is a graphics device for R that is accessible via HTTP.
Start the httpgd server in the container that published a port, and you can access the plot viewer in your browser.
docker run --rm -ti -p 8000:8000 <imagename> R
For details, please check the httpgd
’s vignette for Docker.
2 X11
X11 forwarding by connecting the X11 server in the container to the X11 client on the local machine.
Commands vary depending on the situation, but for example, the commands like below are used.
docker run --rm -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix <imagename> R