Добрый вечер, пытаюсь запустить в докере приложение nodejs и бд mongodb. При запуске происходит ошибка:
$ docker-compose up --build -d
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.networks: 'app-network'
Unsupported config option for services.volumes: 'dbdata'
Смотрел документацию и гуглил, но ответ не нашел. Версия докера:
20.10.3
Dockerfile:
FROM node:14.16.0-alpine3.10
RUN mkdir -p /app/node_modules && chown -R node:node /app
WORKDIR /app
COPY package*.json .
USER node
RUN npm install
COPY --chown=node:node . .
CMD [ "npm", "start" ]
docker-compose.yml
version: "3.8"
services:
node-app:
build:
context: .
dockerfile: Dockerfile
container_name: node-app
ports:
- "80:80"
env_file: .env
networks:
- app-network
mongodb:
image: mongo:4.1.8-xenial
container_name: mongodb
env_file: .env
environment:
- MONGO_INITDB_ROOT_USERNAME=$MONGO_USERNAME
- MONGO_INITDB_ROOT_PASSWORD=$MONGO_PASSWORD
volumes:
- dbdata:/data/db
networks:
- app-network
networks:
app-network:
volumes:
dbdata:
.env
MONDO_PROTOCOL="mongodb"
MONGO_USERNAME="some_name"
MONGO_PASSWORD="some_password"
MONGO_HOSTNAME="127.0.0.1"
MONGO_PORT="27017"
MONGO_DB="test"