Site updated at 2018-03-06 20:31:29 UTC

This commit is contained in:
Travis CI 2018-03-06 20:31:29 +00:00
parent 4053ead194
commit 9e305c40d3
31 changed files with 85 additions and 81 deletions

View file

@ -81,11 +81,12 @@
</code></pre>
</div>
<h3><a class="title-link" name="macos" href="#macos"></a> macOS</h3>
<p>When using <code class="highlighter-rouge">boot2docker</code> on macOS you are unable to map the local time to your Docker container. Use <code class="highlighter-rouge">-e "TZ=America/Los_Angeles"</code> instead of <code class="highlighter-rouge">-v /etc/localtime:/etc/localtime:ro</code>. Replace “America/Los_Angeles” with <a href="http://en.wikipedia.org/wiki/List_of_tz_database_time_zones">your timezone</a>.</p>
<p>Additionally, if your expectation is that you will be able to browse directly to <code class="highlighter-rouge">http://localhost:8123</code> on your macOS host, then you will also need to replace the <code class="highlighter-rouge">--net=host</code> switch with <code class="highlighter-rouge">-p 8123:8123</code>. This is currently the only way to forward ports on to your actual host (macOS) machine instead of the virtual machine inside <code class="highlighter-rouge">xhyve</code>. More detail on this can be found in <a href="https://forums.docker.com/t/should-docker-run-net-host-work/14215/10">the docker forums</a>.</p>
<p>When using <code class="highlighter-rouge">docker-ce</code> (or <code class="highlighter-rouge">boot2docker</code>) on macOS, you are unable to map the local timezone to your Docker container (see Docker issue https://github.com/docker/for-mac/issues/44). Instead of <code class="highlighter-rouge">-v /etc/localtime:/etc/localtime:ro</code>, just pass in the timezone environment variable when you launch the container, ex: <code class="highlighter-rouge">-e "TZ=America/Los_Angeles"</code>. Replace “America/Los_Angeles” with <a href="http://en.wikipedia.org/wiki/List_of_tz_database_time_zones">your timezone</a>.</p>
<p>If you wish to browse directly to <code class="highlighter-rouge">http://localhost:8123</code> from your macOS host, meaning forward ports directly to the container, replace the <code class="highlighter-rouge">--net=host</code> switch with <code class="highlighter-rouge">-p 8123:8123</code>. More detail can be found in <a href="https://forums.docker.com/t/should-docker-run-net-host-work/14215/10">the docker forums</a>.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>docker run -d --name<span class="o">=</span><span class="s2">"home-assistant"</span> -v /path/to/your/config:/config -e <span class="s2">"TZ=America/Los_Angeles"</span> -p 8123:8123 homeassistant/home-assistant
</code></pre>
</div>
<p>Alternatively, <code class="highlighter-rouge">docker-compose</code> works with any recent release of <code class="highlighter-rouge">docker-ce</code> on macOS. Note that (further down this page) we provide an example <code class="highlighter-rouge">docker-compose.yml</code> however it differs from the <code class="highlighter-rouge">docker run</code> example above. To make the .yml directives match, you would need to make <em>two</em> changes: first add the equivalent <code class="highlighter-rouge">ports:</code> directive, then <em>remove</em> the <code class="highlighter-rouge">network_mode: host</code> section. This is because <code class="highlighter-rouge">Port mapping is incompatible with network_mode: host:</code>. More details can be found at [Docker networking docs] (https://docs.docker.com/engine/userguide/networking/#default-networks). Note also the <code class="highlighter-rouge">/dev/tty*</code> device name used by your Arduino etc. devices will differ from the Linux example, so the compose <code class="highlighter-rouge">mount:</code> may require updates.</p>
<h3><a class="title-link" name="windows" href="#windows"></a> Windows</h3>
<p>When running Home Assistant in Docker on Windows, you may have some difficulty getting ports to map for routing (since the <code class="highlighter-rouge">--net=host</code> switch actually applies to the hypervisors network interface). To get around this, you will need to add port proxy ipv4 rules to your local Windows machine, like so (Replacing 192.168.1.10 with whatever your Windows IP is, and 10.0.50.2 with whatever your Docker containers IP is):</p>
<div class="highlighter-rouge"><pre class="highlight"><code>netsh interface portproxy add v4tov4 listenaddress=192.168.1.10 listenport=8123 connectaddress=10.0.50.2 connectport=8123