I have docker-compose.yml
like following
version: '3'
services:
api-server:
build: ./api
links:
- 'db'
ports:
- '3000:3000'
volumes:
- ./api:/src
- ./src/node_modules
tty: true
container_name: api-server
db:
build:
context: .
dockerfile: ./db/Dockerfile
restart: always
hostname: db
environment:
MYSQL_ROOT_PASSWORD: test
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_DATABASE: test
volumes:
- './db:/config'
ports:
- 3306:3306
container_name: db
When I tried to docker-compose up
$ docker-compose up -d
I suffered some error like following one.
It seems like to set them absolute path. but before this message didn't appeared.
I'd like to know
①What cause this error.
③How to fix it without rewrite to absolute path.
db is up-to-date
Recreating bf6187ceff2f_api-server ... error
ERROR: for bf6187ceff2f_api-server Cannot create container for service api-server: invalid volume specification: '9131f8ce856163b2935bd8f09d5e6a2e67509fd5adee9b2d1903cd760639beaa:src/node_modules:rw': invalid mount config for type "volume": invalid mount path: 'src/node_modules' mount path must be absolute
ERROR: for api-server Cannot create container for service api-server: invalid volume specification: '9131f8ce856163b2935bd8f09d5e6a2e67509fd5adee9b2d1903cd760639beaa:src/node_modules:rw': invalid mount config for type "volume": invalid mount path: 'src/node_modules' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
If someone has opinion,please let me know.
Thanks