Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef3278a

Browse files
datdamnzotzfrenck
authored andcommitted
Remove host/netsh commands from docker directives (home-assistant#11133)
* Remove host/netsh commands from docker directives Added -p 8123:8123 to the Windows docker command line. Seems more reliable and easier for users. Add ports to docker-compose.yaml files for easier launches.. * revert requested items. * ✏️ Tweaks
1 parent 51a5e2b commit ef3278a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/_docs/installation/docker.markdown

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,23 @@ Alternatively, `docker-compose` works with any recent release of `docker-ce` on
4040

4141
### Windows
4242

43+
Docker containers are completely isolated from its Windows host system. So when you delete a container, all the changes you made to that container are also removed. If you want to have configuration files or other assets remain persistent, try mounting Windows folders on containers.
44+
45+
Before proceeding, make sure you have shared out a drive for docker to mount to. This will allow the saving of config files to persist on the local machine rather than in the docker container (which may be destroyed when upgraded).
46+
47+
<https://docs.docker.com/docker-for-windows/#shared-drives>
48+
<https://docs.docker.com/docker-for-windows/troubleshoot/#verify-domain-user-has-permissions-for-shared-drives-volumes>
49+
4350
```powershell
4451
$ docker run --init -d --name="home-assistant" -e "TZ=America/Los_Angeles" -v /PATH_TO_YOUR_CONFIG:/config --net=host homeassistant/home-assistant:stable
4552
```
4653

54+
It’s easier to understand the trick when put into practice. Here we would like to mount a current working directory (something like `C:\Users\<your login name>\homeassistant` make sure this exists first) into the `homeassistant/home-assistant:stable` image at the `/config` location in the container. We would do that as so:
55+
56+
```powershell
57+
$ docker run --init -d --name="home-assistant" -e "TZ=America/Los_Angeles" -v //c/Users/<your login name>/homeassistant:/config --net=host homeassistant/home-assistant:stable
58+
```
59+
4760
When running Home Assistant in Docker on Windows, you may have some difficulty getting ports to map for routing (since the `--net=host` switch actually applies to the hypervisor's 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 container's IP is):
4861

4962
```bash

0 commit comments

Comments
 (0)