Note: This tutorial supports only unity ml-agents v0.11.0.
- Unity Linux Build Support Component
- Docker
-
Download the Unity Installer and add the Linux Build Support Component
-
Download and install Docker if you don't have it setup on your machine.
-
Since Docker runs a container in an environment that is isolated from the host machine, a mounted directory in your host machine is used to share data, e.g. the trainer configuration file, Unity executable, curriculum files and TensorFlow graph. For convenience, we created an empty
unity-volumedirectory at the root of the repository for this purpose, but feel free to use any other directory. The remainder of this guide assumes that theunity-volumedirectory is the one used.
Using Docker for ML-Agents involves three steps: building the Unity environment with specific flags, building a Docker container and, finally, running the container. If you are not familiar with building a Unity environment for ML-Agents, please read through our Getting Started with the 3D Balance Ball Example guide first.
If you want to used the Editor to perform training, you can skip this step.
Since Docker typically runs a container sharing a (linux) kernel with the host machine, the Unity environment has to be built for the linux platform. When building a Unity environment, please select the following options from the the Build Settings window:
- Set the Target Platform to
Linux - Set the Architecture to
x86_64 - If the environment does not contain visual observations, you can select the
headlessoption here.
Then click Build, pick an environment name (e.g. 3DBall) and set the output
directory to unity-volume. After building, ensure that the file
<environment-name>.x86_64 and subdirectory <environment-name>_Data/ are
created under unity-volume.
Upload the files under unity-volume to your S3 bucket.
First, make sure the Docker engine is running on your machine. Then build the Docker container by calling the following command at the top-level of the repository:
docker build -t <image-name> .Replace <image-name> with a name for the Docker image, e.g.
balance.ball.v0.1.
Push the docker image you created to AWS ECR.
Use the uploaded files as input of SageMaker trainig job. The container performs training on the SageMaker training instance and automatically upload the output to your S3 bucket.

