Я пытаюсь выполнить команду после запуска Docker-контейнера.
Вот мой Dockerfile
FROM mysite:myport/mongo:3.6
EXPOSE 27017
ADD mongo.js /data/mongodb/scripts/
Вот мой Docker-compose.yml
mongo:
image: test-mongo
container_name: test-mongo
hostname: mongo
expose:
- "27017"
ports:
- "27017:27017"
command: mongo --eval load("/data/mongodb/scripts/mongo.js")
docker-compose --no-ansi up возвращает меня
Creating test-mongo ...
Creating test-mongo ... done
Attaching to test-mongo
test-mongo | MongoDB shell version v3.6.5
test-mongo | connecting to: mongodb://127.0.0.1:27017
test-mongo | 2018-06-09T15:46:50.229+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), rea
son: Connection refused
test-mongo | 2018-06-09T15:46:50.229+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
test-mongo | connect@src/mongo/shell/mongo.js:251:13
test-mongo | @(connect):1:6
test-mongo | exception: connect failed
test-mongo exited with code 1
Я не понимаю, как я могу загрузить свой файл после запуска mongodb