Docker Составьте вопрос:
Мой каталог выглядит так:
total 720
drwxr-xr-x 2 anix anix 4096 Apr 14 13:40 bin
drwxr-xr-x 2 anix anix 4096 Apr 14 06:21 config
-rw-r--r-- 1 anix anix 788 Apr 14 13:38 docker-compose.yml
-rw-r--r-- 1 anix anix 361 Apr 14 13:39 dockerfile
-rw-r--r-- 1 anix anix 651 Apr 6 16:35 ecosystem.config.js
-rw-r--r-- 1 anix anix 2661 Apr 6 16:35 package.json
-rw-r--r-- 1 anix anix 689928 Apr 6 16:28 package-lock.json
drwxr-xr-x 4 anix anix 4096 Apr 4 09:30 public
-rw-r--r-- 1 anix anix 832 Apr 7 01:51 README.md
drwxr-xr-x 5 anix anix 4096 Apr 4 02:36 src
drwxr-xr-x 2 anix anix 4096 Apr 4 04:24 __test__
-rw-r--r-- 1 anix anix 2887 Apr 6 14:16 webpack.config.js
вот мой файл docker-compose.yml:
version: '3.4'
services:
web:
build:
context: ./
dockerfile: dockerfile
depends_on:
- db
ports:
- "8000:5000"
volumes:
- .:/usr/src/app
environment:
NODE_ENV: development
MONGO_URL: mongodb://db:27017/test
stdin_open: true
tty: true
db:
image: mongo:latest
restart : always
volumes:
- dbdata:/data/db
ports:
- "27017:27017"
volumes:
dbdata:
А вот и dockerfile
:
FROM node:alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
EXPOSE 5000
ENV NODE_ENV development
COPY package.json package-lock.json ./
RUN npm install
COPY ./webpack.config.js ./
COPY .babelrc ./
COPY .eslintrc.json ./
COPY public ./public
COPY config ./config
COPY src ./src
COPY bin ./bin
COPY __test__ ./__test__
CMD ["npm","server:dev"]
RUN ls
Это проект стека MERN, и docker-compose build
работает нормально, но когда я делаю docker-compose up
, получаю какую-то действительно странную ошибку, подобную этой, в сервисе web
compose:
db_1 | 2019-04-14T16:33:52.828+0000 I NETWORK [initandlisten] waiting for connections on port 27017
db_1 | 2019-04-14T17:18:41.711+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=3d58dc5ae58d
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] db version v4.0.9
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] git version: fc525e2d9b0e4bceff5c2201457e564362909765
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] allocator: tcmalloc
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] modules: none
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] build environment:
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] distmod: ubuntu1604
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] distarch: x86_64
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] target_arch: x86_64
db_1 | 2019-04-14T17:18:41.845+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true } }
db_1 | 2019-04-14T17:18:41.877+0000 W STORAGE [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
db_1 | 2019-04-14T17:18:41.892+0000 I STORAGE [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'
db_1 | 2019-04-14T17:18:45.437+0000 I NETWORK [initandlisten] waiting for connections on port 27017
db_1 | 2019-04-14T17:18:46.075+0000 I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK
samplemern_web_1 exited with code 1
И после этого веб-контейнер останавливается, и работает только контейнер MongoDB, и когда я выполняю контейнер MongoDB в -it
интерактивном режиме и выполняю ls
там, внутри /usr/src/
, появляется весь каталог как пусто