This Docker image comes with openai and pytorch-cpu. This allows users to start working on reinforcement learning in a couple of easy steps.
This image is particularly ideal for Windows users, for whom openai gym is not easily installed.
Current features:
To be developed:
docker build --tag=image_name .
docker pull ttitcombe/rl_pytorch:latest
docker run -it --name=container_name image_name python
. This should enter the python interpreter./usr/local/bin/startup_script.py
as the CMD
,
e.g. docker exec -it container_name /usr/local/bin/startup_script.py
. This should enter a bash script./usr/local/bin/startup_script.py "python /path/to/my/file.py"
as your CMD
./bin/bash
to enter bash or python
to enter the python interpreter.To test that the container works, try recording an environment:
import gym
import torch
env_to_wrap = gym.make("LunarLander-v1")
env = gym.wrappers.Monitor(env_to_wrap, "someDir")
frame = env.reset()
is_done = False
while not is_done:
action = env.action_space.sample()
_, _, is_done, _ = env.step(action)
env.close()
env_to_wrap.close()
If this doesn't throw an error, then congratulations, you can record OpenAI gym!
You can extract the recording once you are outside of the container with the command docker cp container_name:/path/to/my/file local/path/to/file
.