I'm attempting to figure out how to make a docker container that automatically creates the database user profile. I'm using a Dockerfile and figured I could include the commands for creating the user there.
Does anyone know how to do this? I am still a beginner in docker so any help would be much appreciated.
FROM mongo:latest
RUN mongo &&\
use tewtdb &&\
db.createUser({user: '<user>', pwd: '<pwrd>', roles[{role: 'dbOwner', db: 'tewtdb'}]})
EXPOSE 27017
CMD ["mongod"]