I've got following problem: Need to create mongodb docker image with some initial data and config, so I started writing Dockerfile:
Dockerfile:
FROM mongo:latest
EXPOSE 27017
ADD ./scripts /scripts
RUN mongo PBM /scripts/indexes
/scripts/indexes:
db.events.createIndex( {'x1':1}, {expireAfterSeconds: 0})
And here I've occured first error, that I cannot connect to db:
Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
Any ideas ?
SOLUTION
need to use ENTRYPOINT against RUN, because when using the second one, db does not exist.