Open AI Gym Display


I’ve created a docker image that prepares an environment for Open AI Gym. When I run a container with the following command:

docker run --rm -it -P -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --device /dev/dri -v /home/ari/projects/gym:/home/dev/projects/gym ari/sandbox

I’m able to execute code that is present in the “gym” directory. The code runs, and executes everything EXCEPT env.render(). Upon reaching this line of code, the following error is thrown:

pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None" Does anyone know how to resolve this issue and display the renderings on the host? For reference, I’ve been using this blog post on using GUIs in containers.