Skip to content
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