As part of working on T424859: The `og:image` tag for the wikipedia.org portal leads to a broken image thumbnail, I wanted to test my changes locally before pushing them to Gerrit.
I first ran fresh-node in the directory of the repo I was working within for that task (wikimedia/portals), and then followed (most of) the instructions in that repo's CONTRIBUTING.md file in order to try and get that repo running locally:
- npm install
- npm run build-all-portals
- npm run start --portal=wikipedia.org
After running the last command, I tried visiting http://localhost:8000/src/wikipedia.org/ (as stated in the CONTRIBUTING.md file), but nothing was loading.
I then searched for tasks under the Fresh Phab project containing the word localhost (I guess, in case there were any tasks that'd been filed about not being able to connect on localhost to a server running within Fresh) and found the task T272316: `fresh-node -env -net` not working on macOS 10.15. This task was what first informed me about Fresh's -net option.
After finding out about the -net option, I then ran fresh-node -net within the same directory (after exiting the current Fresh session).
I ran the commands listed above within my new fresh-node -net session, and....... I still couldn't connect to http://localhost:8000.
The source code behind Fresh's -net option links to https://docs.docker.com/network/network-tutorial-host/, so that was my next port of call. Annoyingly, though, a page at that URL no longer seems to exist (obviously it's not a cool URI :/), so I then found an archived copy of the page from February 2025 on the Wayback Machine.
Among other things, that (archived) page includes a notice that:
The host networking driver only works on Linux hosts, and as an opt-in feature in Docker Desktop version 4.34 and later. To enable this feature in Docker Desktop, navigate to the Resources tab in Settings, and then under Network select Enable host networking.
From what I can see, Fresh - in response to the -net option - sends the additional argument --network host to the Docker command that it runs.
I therefore enabled that option within my Docker Desktop app, and tried attempting the above steps again...
....and it now worked - I was now able to access http://localhost:8000 from my machine :D
So I guess, this is probably a long way of asking -- if possible, please can Fresh's -net option (and what is needed to be enabled in order to use it) be officially documented somewhere? :)