# Running dev environment on Windows WSL

**URL:** <https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970>\
**Category:** Technical Support\
**Created:** [June 30, 2022, 1:48pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970 "2022-06-30T13:48:35Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![oyierphil](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/oyierphil/32/946_2.png) [@oyierphil](https://forum.communityhealthtoolkit.org/u/oyierphil)\
**Post date:** [June 30, 2022, 1:48pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/1 "2022-06-30T13:48:35Z")

</div>

Hi  
I have configured WSL on my Win 10 for CHT Local Environment testing, and after starting Docker, I get the error below: 404 Not Found, nginx/1.13.6

 ![WSL Errors](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/e/e205d6c7d47f6b85d16209937f72a58b82f5822c.png)  
 ![WSL Errors4](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/d/dfd8b5ecffd871313d8a1fc34c3038887622df67.png)  
 ![WSL Errors5](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/a/ac7e676d9e43194abf77b093f2da2ad764bb2730.png)

Any one with an idea? Tried different things, none working so far

---

<div class="post-metadata">

**Author:** ![derick](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/derick/32/78_2.png) [@derick](https://forum.communityhealthtoolkit.org/u/derick)\
**Post date:** [June 30, 2022, 3:42pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/2 "2022-06-30T15:42:36Z")

</div>

Can you confirm if your all your containers got started? `docker ps -a`

Alternatively, this might be come in handy in dealing with some of the docker-compose issues [cht-core/scripts/docker-helper at master · medic/cht-core · GitHub](https://github.com/medic/cht-core/tree/master/scripts/docker-helper)

---

<div class="post-metadata">

**Author:** ![oyierphil](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/oyierphil/32/946_2.png) [@oyierphil](https://forum.communityhealthtoolkit.org/u/oyierphil)\
**Post date:** [June 30, 2022, 5:03pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/3 "2022-06-30T17:03:30Z")

</div>

@derick  
I think the challenge is WSL VM IP and local machine IP, need to figure it out  
I share the status of the containers

 ![WSL Errors5_Containers](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/3/30d75adeb8e04353049f1d32aecf769e9d6afa88.png)

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [June 30, 2022, 6:49pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/4 "2022-06-30T18:49:33Z")

</div>

@oyierphil - I think you should try a restart:

```auto
cd /var/boda_comm
sudo docker-compose restart

```

As well, you can find the IP of your WSL VM with:

```auto
ip -o addr show eth0
4: eth0 inet 192.168.37.56/20 brd 192.168.47.255 scope global eth0\ valid_lft forever preferred_lft forever
4: eth0 inet6 fe80::215:5dff:fe64:20f2/64 scope link \ valid_lft forever preferred_lft forever

```

So for me, my IP would be `192.168.37.56`.

Per @derick’s comment, I also recommend the [CHT Docker Helper](https://github.com/medic/cht-core/tree/master/scripts/docker-helper) script he cited. It handles a lot of these issues for you and also installs a valid TLS certificate so your install works with Android for entirely local and offline testing!

---

<div class="post-metadata">

**Author:** ![oyierphil](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/oyierphil/32/946_2.png) [@oyierphil](https://forum.communityhealthtoolkit.org/u/oyierphil)\
**Post date:** [June 30, 2022, 7:40pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/5 "2022-06-30T19:40:59Z")

</div>

Dear Jones  
I have tried all the options above and so far none has worked  
Will try restarting again tomorrow  
Regards

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [June 30, 2022, 10:08pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/6 "2022-06-30T22:08:29Z")

</div>

@oyierphil - oh no! I’m sorry to hear that. However, I’m glad you reported you’re still having problems. I asked another teammate who has access to a windows system to see if they can offer and advice.

For the CHT Docker Helper script, did it end up going through all 5 tries and failing? This can often take many minutes on older hardware. As well, restarting your entire computer may help (which I think you said you’d try tomorrow).

---

<div class="post-metadata">

**Author:** ![oyierphil](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/oyierphil/32/946_2.png) [@oyierphil](https://forum.communityhealthtoolkit.org/u/oyierphil)\
**Post date:** [July 4, 2022, 9:39am UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/7 "2022-07-04T09:39:44Z")

</div>

@mrjones  
Had tried restarting the containers earlier, but wanted to try again this morning, same error, **404 Not Found —nginx/1.13.6**  
Figuring out where the problem is, will try again in the evening

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [July 11, 2022, 11:03pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/8 "2022-07-11T23:03:44Z")

</div>

@oyierphil - Any luck with the restarts or the [CHT Docker Helper](https://github.com/medic/cht-core/tree/master/scripts/docker-helper) script?

---

<div class="post-metadata">

**Author:** ![oyierphil](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/oyierphil/32/946_2.png) [@oyierphil](https://forum.communityhealthtoolkit.org/u/oyierphil)\
**Post date:** [July 17, 2022, 3:27pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/9 "2022-07-17T15:27:50Z")

</div>

@mrjones  
Not yet solved, tried many options this afternoon and not yet, will try again later  
Interesting I can ping 127.0.0.1 from the terminal but cant access the same on the browser, will try again later  
Will use the remote instance for testing now, good afternoon

 ![Localhost 404 error](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/b/b55fef22286884e30e2915df98c46af3fb727415.png)

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [July 18, 2022, 6:34pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/10 "2022-07-18T18:34:48Z")

</div>

@oyierphil - oh no! I’m sorry you’re still having problems : (

I have a spare windows machine and I was able to get the CHT running locally by using the CHT Docker Helper Script:

1. Ensuring I have [WSL 2 installed](https://docs.microsoft.com/en-us/windows/wsl/install) and running

2. [Install Docker Desktop](https://docs.docker.com/desktop/install/windows-install/)

3. Make sure Docker Destkop is running and in compose v2.0. The script failed on non-obvious ways when Docker Desktop was not running after a reboot - hence me checking “Start when you login”. As well, it would not work unless compose v2 was checked:  

4. Launch a WSL command line with Start Menu → wsl

5. `cd` into your clone of the [CHT Core](https://github.com/medic/cht-core/) Repo `cht-core/scripts/docker-helper`

6. create your `env` file per the [steps in “First Run”](https://github.com/medic/cht-core/tree/master/scripts/docker-helper#first-run)

7. Run the helper script and enjoy a local dev environment!

---

<div class="post-metadata">

**Author:** ![oyierphil](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/oyierphil/32/946_2.png) [@oyierphil](https://forum.communityhealthtoolkit.org/u/oyierphil)\
**Post date:** [August 28, 2022, 1:51pm UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/11 "2022-08-28T13:51:29Z")

</div>

@mrjones  
I today managed to start a local development environment on WSL after installing Docker Destkop. Followed the steps above, number 6 took me to another page ([cht-core/scripts/docker-helper at master · medic/cht-core · GitHub](https://github.com/medic/cht-core/tree/master/scripts/docker-helper)), which has another link to the documentation ([https://docs.communityhealthtoolkit.org/apps/guides/hosting/4.x/app-developer/](https://docs.communityhealthtoolkit.org/apps/guides/hosting/app-developer/#cht-docker-helper)). Figuring out how to create the `.env` file, given that I have a complete project folder with my configs and forms, will appreciate your insights

I have however managed to run the cht-core application on my local computer after accepting the security risks due to lack of SSL certificate

 ![cht-core App](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/d/d689b2d31622f89809a2addb8105e98ed232eeed.png)

Hope this work when I change to my project folder, push my configs and forms for testing on the different places and roles

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [August 30, 2022, 4:32am UTC](https://forum.communityhealthtoolkit.org/t/running-dev-environment-on-windows-wsl/1970/12 "2022-08-30T04:32:12Z")

</div>

@oyierphil - That’s such great news - thanks for reporting back about your success!

To create an `.env` file, you can follow the “First Run” [steps here](https://docs.communityhealthtoolkit.org/apps/guides/hosting/app-developer/#first-run), but it’s just three variables for project name, HTTP port and HTTPS port. It looks like this:

```sh
COMPOSE_PROJECT_NAME=my_first_project
CHT_HTTP=8080
CHT_HTTPS=8443   

```

You then specify the path to it with the `-e` flag. You’ll always want to specify the relative path like this:

```auto
./cht-docker-compose.sh -e ../../../my_first_project/.env_docker

```

Finally, to get valid TLS certificates, you can get the CHT URL from the docker helper as seen here:

 ![image](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/9/9656c757078c2c871dc3d4511b7631d29bace765.jpeg)

In you’re screenshot you’re using `https://localhost` (and also implicitly port `443`), but the CHT Docker Helper installs certificates for `*.my.local-ip.co`. The `*` part is the IP of your container but with dashes. So in my screenshot, the IP is `172.24.104.228` which the helper script has translated to the final URL of `https://172-24-104-228.my.local-ip.co:8443`

Best of luck!
