I am trying to find a way to create a docker container that when created has the db user profile created automatically. I am using a dockerfile and thought i could add the commands to create the user in it.
Anyone done this before and know what I am doing wrong here. I am no expert at Docker.
FROM mongo:latest
RUN mongo &&\
use tewtdb &&\
db.createUser({user: '<user>', pwd: '<pwrd>', roles[{role: 'dbOwner', db: 'tewtdb'}]})
EXPOSE 27017
CMD ["mongod"]