.\"t .\" WARNING: Do not edit this file manually, it is generated from README.md automatically. .\" .\"t .\" Automatically generated by Pandoc 1.16.0.2 .\" .TH "MONGODB\-32\-RHEL7" "1" "February 22, 2017" "Container Image Pages" "" .hy .SH MongoDB Docker image .PP This repository contains Dockerfiles for MongoDB images for general usage and OpenShift. Users can choose between RHEL and CentOS based images. .SS Environment variables .PP The image recognizes the following environment variables that you can set during initialization by passing \f[C]\-e\ VAR=VALUE\f[] to the Docker run command. .PP .TS tab(@); l l. T{ Variable name T}@T{ Description T} _ T{ \f[C]MONGODB_USER\f[] T}@T{ User name for MONGODB account to be created T} T{ \f[C]MONGODB_PASSWORD\f[] T}@T{ Password for the user account T} T{ \f[C]MONGODB_DATABASE\f[] T}@T{ Database name T} T{ \f[C]MONGODB_ADMIN_PASSWORD\f[] T}@T{ Password for the admin user T} .TE .PP The following environment variables influence the MongoDB configuration file. They are all optional. .PP .TS tab(@); lw(13.6n) lw(45.8n) lw(10.5n). T{ Variable name T}@T{ Description T}@T{ Default T} _ T{ \f[C]MONGODB_QUIET\f[] T}@T{ Runs MongoDB in a quiet mode that attempts to limit the amount of output. T}@T{ true T} .TE .PP You can also set the following mount points by passing the \f[C]\-v\ /host:/container\f[] flag to Docker. .PP .TS tab(@); l l. T{ Volume mount point T}@T{ Description T} _ T{ \f[C]/var/lib/mongodb/data\f[] T}@T{ MongoDB data directory T} .TE .PP \f[B]Notice: When mouting a directory from the host into the container, ensure that the mounted directory has the appropriate permissions and that the owner and group of the directory matches the user UID or name which is running inside the container.\f[] .SS Usage .PP For this, we will assume that you are using the \f[C]centos/mongodb\-32\-centos7\f[] image. If you want to set only the mandatory environment variables and store the database in the \f[C]/home/user/database\f[] directory on the host filesystem, execute the following command: .IP .nf \f[C] $\ docker\ run\ \-d\ \-e\ MONGODB_USER=\ \-e\ MONGODB_PASSWORD=\ \-e\ MONGODB_DATABASE=\ \-e\ MONGODB_ADMIN_PASSWORD=\ \-v\ /home/user/database:/var/lib/mongodb/data\ centos/mongodb\-32\-centos7 \f[] .fi .PP If you are initializing the database and it\[aq]s the first time you are using the specified shared volume, the database will be created with two users: \f[C]admin\f[] and \f[C]MONGODB_USER\f[]. After that the MongoDB daemon will be started. If you are re\-attaching the volume to another container, the creation of the database user and admin user will be skipped and only the MongoDB daemon will be started. .SS Custom configuration file .PP It is allowed to use custom configuration file for mongod server. Providing a custom configuration file supercedes the individual configuration environment variable values. .PP To use custom configuration file in container it has to be mounted into \f[C]/etc/mongod.conf\f[]. For example to use configuration file stored in \f[C]/home/user\f[] directory use this option for \f[C]docker\ run\f[] command: \f[C]\-v\ /home/user/mongod.conf:/etc/mongod.conf:Z\f[]. .PP \f[B]Notice: Custom config file does not affect name of replica set. It has to be set in \f[C]MONGODB_REPLICA_NAME\f[] environment variable.\f[] .SS MongoDB admin user .PP The admin user name is set to \f[C]admin\f[] and you have to to specify the password by setting the \f[C]MONGODB_ADMIN_PASSWORD\f[] environment variable. This process is done upon database initialization. .SS Changing passwords .PP Since passwords are part of the image configuration, the only supported method to change passwords for the database user (\f[C]MONGODB_USER\f[]) and admin user is by changing the environment variables \f[C]MONGODB_PASSWORD\f[] and \f[C]MONGODB_ADMIN_PASSWORD\f[], respectively. .PP Changing database passwords directly in MongoDB will cause a mismatch between the values stored in the variables and the actual passwords. Whenever a database container starts it will reset the passwords to the values stored in the environment variables. .SH AUTHORS Red Hat.