title: running bazel remote executor test on separate machines
body: <p>The remote worker guide of bazel (<a href="https://github.com/bazelbuild/bazel/tree/master/src/tools/remote_worker" rel="noreferrer">here</a>) explains how to start the remote-worker locally and then run bazel against it.</p>
  
  <p>I tried it and indeed that worked (with bugs that <a href="https://github.com/bazelbuild/bazel/issues/3121" rel="noreferrer">reported in GH</a>)</p>
  
  <p>Another attempt was to create run the remote worker on a virtual separate machine, by running it inside docker container and running bazel against it. But it failed in a different way - and I think this time I'm using it wrong.</p>
  
  <p>Here's my docker file:</p>
  
  <pre><code>FROM openjdk:8
  
  # install release bazel from apt
  RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
  RUN curl https://bazel.build/bazel-release.pub.gpg |  apt-key add -
  RUN apt-get update &amp;&amp; apt-get install -y zip bazel
  
  # compile dev bazel from sources
  RUN mkdir -p /usr/src/bazel
  # "bazel" has the latest development code of bazel from github
  COPY bazel /usr/src/bazel
  WORKDIR /usr/src/bazel
  RUN bazel build src/bazel
  
  # compile remote_worker using latest development bazel
  RUN bazel-bin/src/bazel build //src/tools/remote_worker
  
  # prepare cache folder
  RUN mkdir -p /tmp/test
  
  # Run remote-worker
  CMD ["bazel-bin/src/tools/remote_worker/remote_worker","--work_path=/tmp/test","--listen_port=3030"]
  </code></pre>
  
  <p>After building it I simply ran the docker binding the port to the localhost:</p>
  
  <pre><code>$ docker build -t bazel-worker .
  $ docker run -p 3030:3030 bazel-worker
  </code></pre>
  
  <p>Then ran bazel java test to run using the remote worker:
  (Can check out my test repo <a href="https://github.com/or-shachar/bazel-sample-repo" rel="noreferrer">here</a>)</p>
  
  <pre><code>$ bazel --host_jvm_args=-Dbazel.DigestFunction=SHA1 test \
        --spawn_strategy=remote \
        --remote_executor=localhost:3030 \
        --remote_cache=localhost:3030 \
        --strategy=Javac=remote \
        --remote_local_fallback=false \
        --remote_timeout=600 \
        //src/main/java/com/example/...
  </code></pre>
  
  <p>But I got this weird error message:</p>
  
  <pre><code>____Loading package: src/main/java/com/example
  ____Loading package: @bazel_tools//tools/cpp
  ____Loading package: @local_jdk//
  ____Loading package: @local_config_xcode//
  ____Loading package: @local_config_cc//
  ____Loading complete.  Analyzing...
  ____Loading package: tools/defaults
  ____Loading package: @bazel_tools//third_party/java/jdk/langtools
  ____Loading package: @junit//jar
  ____Found 1 test target...
  ____Building...
  ____[0 / 2] BazelWorkspaceStatusAction stable-status.txt
  ____[2 / 4] Creating source manifest for //src/main/java/com/example:my_test
  ____From Extracting interface @junit//jar:jar:
  /tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar: 1: /tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar: �����0��!H__PAGEZEROx__TEXTpp__text__TEXT/��__stubs__TEXT0p�__stub_helper__TEXT���__gcc_except_tab__TEXT�: not found
  /tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar: 2: /tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar: Syntax error: word unexpected (expecting ")")
  ERROR: /private/var/tmp/_bazel_ors/719f891d5db9fd5e73ade25b0c847fd1/external/junit/jar/BUILD.bazel:2:1: output 'external/junit/jar/_ijar/jar/external/junit/jar/junit-4.12-ijar.jar' was not created.
  ERROR: /private/var/tmp/_bazel_ors/719f891d5db9fd5e73ade25b0c847fd1/external/junit/jar/BUILD.bazel:2:1: not all outputs were created or valid.
  ____Building complete.
  Target //src/main/java/com/example:my_test failed to build
  Use --verbose_failures to see the command lines of failed build steps.
  ____Elapsed time: 13.614s, Critical Path: 0.21s
  </code></pre>
  
  <p><strong>Am I doing anything wrong? Do I need to run it differently when running the remote worker on an actual (or virtual) remote machine (vs. just running it locally)?</strong></p>
  
  <hr>
  
  <p><strong>Important to mention</strong>: my machine is <code>mac osx sierra</code>. , I believe that docker <code>openjdk:8</code> is ubuntu based, I'm running locally bazel development version (sha <code>956810b6ee24289e457a4b8d0a84ff56eb32c264</code>).</p>