I’m using Strapi on a Docker container and struggling to use the option --watch-admin. It looks like Strapi exposes port 8000 when --watch-admin is enabled but it cannot be accessed on the host machine even with port forwarding enabled. If I try accessing port 8000 inside the Strapi container, it succeeded. Is there any good way to use strapi develop --watch-admin with Docker? Thank you in advance.
I havn’t had any luck inside a docker container, I had luck run it on port 8000 with watch-admin if I extended admin.config.js or added the file manually.
You might be running npm run develop --watch-admin? That will actually run the npm script called ‘develop’ and not the strapi develop command. It will not pass the option, therefore the admin watch will not run.
So, create an extra script inside the package.json so that your npm scripts reflect this:
I would suggest NOT run it as a docker container.
If you are doing local development, then run it locally, and have a database etc in a container much faster and less stress on a drive. It also boils down to how setup the stack.
As of version: 4.25.1 (or sooner) I can use the --polling option to detect changes on docker volumes rebuilding the admin successfully inside docker. Developing in docker is my preferred method as it matches production more exact.