I'm starting to learn Docker, and i'm following this (very) long tutorial: https://www.youtube.com/watch?v=9zUHg7xjIqQ
I have a Dockerfile and a docker-compose.yml .
It work fine on my fine on my machine (we all know this sentence), but when my friend pulled what i've done, he obtains this error message:
Error response from daemon: invalid mount config for type "volume": invalid mount path: 'node_back/node_modules' mount path must be absolute
Here are my files:
Dockerfile in node_back/ :
WORKDIR /app
COPY package.json .
RUN npm install
COPY . ./
EXPOSE 3000
CMD ["npm", "run", "dev"]
docker-compose at the root:
services:
back-container:
build: ./node_back
image: back-image:tag
ports:
- "3000:3000"
volumes:
- ./node_back:/app
- ./node_back/node_modules
environment:
- PORT=3000
I used the command:
sudo docker-compose up -d
to launch the docker script.
Can somebody explain my error, and why it work on my side?
Thanks!
CodePudding user response:
Because you forgot ':' on volume path line.
./node_back/node_modules
you should be used ':' for separate your local volume and docker volume
./node_back/node_modules:WHERE-YOUR-WANT-DOCKER-PATH