Unity-Technologies / obstacle-tower-challenge

Starter Kit for the Unity Obstacle Tower challenge
Apache License 2.0
119 stars 38 forks source link

My 1st docker container exit(1) for 'run.sh' and 2nd one exit(127) for 'env.sh' on macOS #18

Open parksurk opened 5 years ago

parksurk commented 5 years ago

Hi~ I am doing “Testing Challenge Evaluation - Run Docker image” in “https://github.com/Unity-Technologies/obstacle-tower-challenge/README.md” like below …

- OS : macOS Mojave version 10.14.1 - Python 3.6 Virtual Environment - Docker Version 2.0.0.3 After building the Docker image, I start the container running your agent script. docker run \ --env OTC_EVALUATION_ENABLED=true \ --network=host \ -it obstacle_tower_challenge:latest ./run.sh In another terminal window, execute the environment. docker run \ --env OTC_EVALUATION_ENABLED=true \ --env OTC_DEMO_EVALUATION=true \ --network=host \ -it obstacle_tower_challenge:latest ./env.sh But…my docker containers exit like below…Please help me to fix this problem…What did I miss? skcc-user:~ parksurk$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a60df393ce84 obstacle_tower_challenge:latest "./run.sh" 35 minutes ago Exited (1) 35 minutes ago xenodochial_swanson 5559cdf2d6ac obstacle_tower_challenge:latest "./env.sh" 36 minutes ago Exited (127) 32 minutes ago awesom < 1st container result> skcc-user:~ parksurk$ docker run --env OTC_EVALUATION_ENABLED=true --network=host -it obstacle_tower_challenge:latest ./run.sh root INFO:mlagents_envs:Start training by pressing the Play button in the Unity Editor. Traceback (most recent call last): File "run.py", line 26, in env = ObstacleTowerEnv(args.environment_filename, docker_training=args.docker_training) File "/srv/conda/lib/python3.6/site-packages/obstacle_tower_env.py", line 39, in init self._env = UnityEnvironment(environment_filename, worker_id, docker_training=docker_training) File "/srv/conda/lib/python3.6/site-packages/mlagents_envs/environment.py", line 69, in init aca_params = self.send_academy_parameters(rl_init_parameters_in) File "/srv/conda/lib/python3.6/site-packages/mlagents_envs/environment.py", line 491, in send_academy_parameters return self.communicator.initialize(inputs).rl_initialization_output File "/srv/conda/lib/python3.6/site-packages/mlagents_envs/rpc_communicator.py", line 80, in initialize "The Unity environment took too long to respond. Make sure that :\n" mlagents_envs.exception.UnityTimeOutException: The Unity environment took too long to respond. Make sure that : The environment does not need user interaction to launch The Academy and the External Brain(s) are attached to objects in the Scene The environment and the Python interface have compatible versions. skcc-user:~ parksurk$ docker run --env OTC_EVALUATION_ENABLED=true --network=host -it obstacle_tower_challenge:latest ./run.sh root INFO:mlagents_envs:Start training by pressing the Play button in the Unity Editor. Traceback (most recent call last): File "run.py", line 26, in env = ObstacleTowerEnv(args.environment_filename, docker_training=args.docker_training) File "/srv/conda/lib/python3.6/site-packages/obstacle_tower_env.py", line 39, in init self._env = UnityEnvironment(environment_filename, worker_id, docker_training=docker_training) File "/srv/conda/lib/python3.6/site-packages/mlagents_envs/environment.py", line 69, in init aca_params = self.send_academy_parameters(rl_init_parameters_in) File "/srv/conda/lib/python3.6/site-packages/mlagents_envs/environment.py", line 491, in send_academy_parameters return self.communicator.initialize(inputs).rl_initialization_output File "/srv/conda/lib/python3.6/site-packages/mlagents_envs/rpc_communicator.py", line 80, in initialize "The Unity environment took too long to respond. Make sure that :\n" mlagents_envs.exception.UnityTimeOutException: The Unity environment took too long to respond. Make sure that : The environment does not need user interaction to launch The Academy and the External Brain(s) are attached to objects in the Scene The environment and the Python interface have compatible versions. <2nd container result> skcc-user:~ parksurk$ docker run --env OTC_EVALUATION_ENABLED=true --env OTC_DEMO_EVALUATION=true --network=host -it obstacle_tower_challenge:latest ./env.sh ENV_PORT= ENV_FILENAME= '[' -z '' ']' ENV_PORT=5005 '[' -z '' ']' ENV_FILENAME=/home/otc/ObstacleTower/obstacletower.x86_64 touch otc_out.json APP_PID=7 xvfb-run --auto-servernum '--server-args=-screen 0 640x480x24' /home/otc/ObstacleTower/obstacletower.x86_64 --port 5005 2 TAIL_PID=8 wait 7 tail -f otc_out.json
spMohanty commented 5 years ago

This seems to be because --net=host doesn't work as expected in Docker for Mac. It's a known (and very irritating) issue.

Possible solutions are to use $DOCKER_HOST environment variable if it's set. Or do a manual port mapping of port 5005 (which is what is used by the environment binary to communicate with the python client).

More on this here : https://dev.to/bufferings/access-host-from-a-docker-container-4099

@awjuliani : Can you confirm that any other ports do not need to be mapped ?

awjuliani commented 5 years ago

For communication between Unity & Python only port 5005 needs to be mapped (assuming worker_id is set to 0. If it is set to a larger number, then port 5005 + worker_id needs to be mapped as well).