I am new to docker and what I am trying to do is to run a react image mapping a directory to current host directory, so that is possible to make changes in the files on the host, that would be automatically reflected in the image.
Dockerfile:
FROM node:16-alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
images in docker :
I am trying to run a docker react image in Windows 10, using this command:
docker run -d -p 5000:3000 --name container1 -v %cd%:/app docker-react-master-dev
The behaviour expected is to create a container named container1 that runs react and sets up a webpage in port 3000 of the container localhost, 5000 of the host. Instead, it creates the container but in a few seconds the status of the container is Exited(127), and the logs are :
When I am not trying to add a volume, it works fine (it creates a container that doesn't stop and it listens to port 5000 on the host).
What am I doing wrong?