Skip to content

Commit

Permalink
openai#15 Update main readme to assist Windows users with getting sta…
Browse files Browse the repository at this point in the history
…rted (openai#169)

* Install pytest in the docker image, and clean up and python cache files

* openai#15 Update main readme to assist Windows users with getting started

* openai#15 Update main readme to assist Windows users with getting started

* openai#15 Update main readme to assist Windows users with getting started

* openai#15 Update main readme to assist Windows users with getting started
  • Loading branch information
jamesweakley authored and tlbtlbtlb committed Mar 31, 2017
1 parent a4f78eb commit c32f2ae
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ RUN pip install gym[all]
# Get the faster VNC driver
RUN pip install go-vncdriver>=0.4.0

# Install pytest (for running test cases)
RUN pip install pytest

# Force the container to use the go vnc driver
ENV UNIVERSE_VNCDRIVER='go'

Expand All @@ -48,3 +51,6 @@ RUN pip install -e .

# Upload our actual code
COPY . ./

# Just in case any python cache files were carried over from the source directory, remove them
RUN py3clean .
51 changes: 50 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,62 @@ run ``docker ps`` and get something like this:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Alternate configuration - running the agent in docker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The above instructions result in an agent that runs as a regular python process in your OS, and launches docker containers as needed for the remotes.
Alternatively, you can build a docker image for the agent and run it as a container as well.
You can do this in any operating system that has a recent version of docker installed, and the git client.

To get started, clone the ``universe`` repo:

.. code:: shell
git clone https://github.com/openai/universe.git
cd universe
Build a docker image, tag it as 'universe':

.. code:: shell
docker build -t universe .
This may take a while the first time, as the docker image layers are pulled from docker hub.

Once the image is built, you can do a quick run of the test cases to make sure everything is working:

.. code:: shell
docker run --privileged --rm -e DOCKER_NET_HOST=172.17.0.1 -v /var/run/docker.sock:/var/run/docker.sock universe pytest
Here's a breakdown of that command:

* ``docker run`` - launch a docker container
* ``--rm`` - delete the container once the launched process finishes
* ``-e DOCKER_NET_HOST=172.17.0.1`` - tells the universe remote (when launched) to make its VNC connection back to this docker-allocated IP
* ``-v /var/run/docker.sock:/var/run/docker.sock`` - makes the docker unix socket from the host available to the container. This is a common technique used to allow containers to launch other containers alongside itself.
* ``universe`` - use the imaged named 'universe' built above
* ``pytest`` - run 'pytest' in the container, which runs all the tests

At this point, you'll see a bunch of tests run and hopefully all pass.

To do some actual development work, you probably want to do another volume map from the universe repo on your host into the container, then shell in interactively:

.. code:: shell
docker run --privileged --rm -it -e DOCKER_NET_HOST=172.17.0.1 -v /var/run/docker.sock:/var/run/docker.sock -v (full path to cloned repo above):/usr/local/universe universe python
As you edit the files in your cloned git repo, they will be changed in your docker container and you'll be able to run them in python.

Note if you are using docker for Windows, you'll need to enable the relevant shared drive for this to work.


Notes on installation
~~~~~~~~~~~~~~~~~~~~~

* When installing ``universe``, you may see ``warning`` messages. These lines occur when installing numpy and are normal.
* You'll need a ``go version`` of at least 1.5. Ubuntu 14.04 has an older Go, so you'll need to `upgrade <https://golang.org/doc/install>`_ your Go installation.
* We run Python 3.5 internally, so the Python 3.5 variants will be much more thoroughly performance tested. Please let us know if you see any issues on 2.7.
* While we don't officially support Windows, we expect our code to be very close to working there. We'd be happy to take pull requests that take our Windows compatibility to 100%.
* While we don't officially support Windows, we expect our code to be very close to working there. We'd be happy to take pull requests that take our Windows compatibility to 100%. In the meantime, the easiest way for Windows users to run universe is to use the alternate configuration described above.

System overview
---------------
Expand Down

0 comments on commit c32f2ae

Please sign in to comment.