DEV Community

Cover image for An OpenAI Gym docker that can render on Windows
Vijay Bhaskar
Vijay Bhaskar

Posted on

An OpenAI Gym docker that can render on Windows

GitHub logo vijjusri14 / OpenAI-Gym-Docker

An OpenAI Gym docker that can render on Windows

This image starts from the jupyter/tensorflow-notebook, and has atari_py installed. Therefore, many environments can be played.

This image is made for running OpenAI Gym on Windows. But in general, it works on other OS like Linux, MacOS etc. as well.

Prerequisite

Description

Build the image

docker build -t openai_gym_docker:v1.0 .
Enter fullscreen mode Exit fullscreen mode

Create and run the instance of the container

Get the Network InterfaceAlias name using the below command

netsh interface ipv4 show interface
Enter fullscreen mode Exit fullscreen mode

Customize the number of CPUs and Memory in the below command according to your system specifications. Also update Network InterfaceAlias from previous command

docker run -itd --name=openai-gym -p 8888:8888 --cpus='3' --memory='6g' --add-host=dockerhost:$(Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias 'Wi-Fi' | Select-Object -ExpandProperty 'IPAddress';) -e DISPLAY=dockerhost:0.0 openai_gym_docker:v1.0
Enter fullscreen mode Exit fullscreen mode

Get Jupyter token

docker exec -it openai-gym bash -c 'jupyter notebook list'
Enter fullscreen mode Exit fullscreen mode

Once the docker instance starts running, open browser and visit http://localhost:8888 and login with the token from above.

Jupyter will promt you to set new password for future logins.

Create/Import Python Notebooks and start exploring Reinforcement Learning 🤖

Stop the container

docker stop openai-gym
Enter fullscreen mode Exit fullscreen mode

Start the container

docker start openai-gym
Enter fullscreen mode Exit fullscreen mode

Top comments (0)