Yarn dev / browsersync in a Docker environment

Hello,

I’m trying to build a complete local to production development template with Docker, WordPress and Sage. So far, it is going ok. I succeded in passing my composer and yarn commands inside the containers, eliminating the need to install composer, node or yarn on my machine. Here is the repo of my progress so far:

The one thing that is still not working is the Bud/browsersync dev mode. I have tried to run yarn dev either from the container or from the host without success. The development url cannot be reached. Are there additional steps I need to perform to make this work, like adding something to my known hosts file? I am a bit lost there and I cannot find the answers in the docs.

Ideally, I would like to find a way to make bud work locally inside the container using docker-compose run --rm node yarn dev. I tried to expose the port 3000 in my docker-compose but it didn’t work either. But again, it did not even work when I run yarn dev on my host machine so I must be doing something wrong.

Thanks for your help,

John