Skip to content

Added details to mongo README to create initial admin user #916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion mongo/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,22 @@ $ docker run --name some-mongo -d mongo --storageEngine wiredTiger

MongoDB does not require authentication by default, but it can be configured to do so. For more details about the functionality described here, please see the sections in the official documentation which describe [authentication](https://docs.mongodb.org/manual/core/authentication/) and [authorization](https://docs.mongodb.org/manual/core/authorization/) in more detail.

#### Add the Initial Admin User via environment variables

```console
$ docker run -e MONGO_INITDB_ROOT_USERNAME=user -e MONGO_INITDB_ROOT_PASSWORD=password mongo
```

This automatically adds the `--auth` flag when starting mongod.


#### Start the Database

```console
$ docker run --name some-mongo -d mongo --auth
```

#### Add the Initial Admin User
#### Add the Initial Admin User via mongo console

```console
$ docker exec -it some-mongo mongo admin
Expand Down