Hot reloading of Gatsby doesn't work inside docker for Windows
In your file docker-compose you must incorporate the following environment variable:
docker-compose.yml
version: '3'services: gatsby-app: build: context: ./ dockerfile: Dockerfile image: gatsby-app container_name: gatsby-app working_dir: /app volumes: - /app/node_modules - ./app:/app ports: - 80:8000 - 81:9000 environment: - NODE_ENV=development - GATSBY_WEBPACK_PUBLICPATH=/ - CHOKIDAR_USEPOLLING=1
Your DockerFile file must be:
Dockerfile
from node:latestEXPOSE 8000RUN npm install -g gatsby-cli yarnWORKDIR /appCOPY ./app/package.json .RUN yarn install && yarn cache cleanCMD ["yarn", "develop", "-H", "0.0.0.0", "-p", "8000"]