Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
Live reload react app working with docker-compose

I have two services: front (product-list) and backend (server-api).

I've created a docker-compose file and it works fine:

version: '3.1'

services:
  server-api:
    build: ./server-api
    ports: 
      - "8080:8080"
  product-list:
    build: ./product-list
    environment:
      CHOKIDAR_USEPOLLING: "true"
    ports: 
      - "3000:3000"
    depends_on:
      - server-api

But I have a problem: the app doesnt reload after a change.

I have read about this, and a lot of people says that CHOKIDAR_USEPOLLING: "true" should works.

It doesnt for me.

I would like to know if is a volume problem (I dont have very clear how they work right now or what volume should I create), or if maybe I should install something to watch the files.

This is the Dockerfile that I have in my frontend app:

FROM node:14-alpine AS development

ENV NODE_ENV development

WORKDIR /app

COPY package.json .
COPY package-lock.json .

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]

And right now I just use docker-compose up to launch the app.

I just need to know about what happend with my react app and why it doesnt reload, backend service (server-api) works fine and I dont need hot reload in that app.

Any help is thankful.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

For the changes to get into container, you need to mount the project as volume. In the current configuration, changes to the project will fall into container only after rebuilding the image.

As example:

  product-list:
    build: ./product-list
    environment:
      CHOKIDAR_USEPOLLING: "true"
    ports: 
      - "3000:3000"
    depends_on:
      - server-api
    volumes:
      - ".:/app"
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!