https://github.com/hatamiarash7/mongo-with-auth
Setup authentication on Official MongoDB image
https://github.com/hatamiarash7/mongo-with-auth
database docker docker-image mongo mongodb
Last synced: 4 months ago
JSON representation
Setup authentication on Official MongoDB image
- Host: GitHub
- URL: https://github.com/hatamiarash7/mongo-with-auth
- Owner: hatamiarash7
- License: gpl-3.0
- Created: 2020-09-02T15:38:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:56:13.000Z (over 1 year ago)
- Last Synced: 2025-02-03T18:57:58.641Z (5 months ago)
- Topics: database, docker, docker-image, mongo, mongodb
- Language: Shell
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MongoDB with authentication
[](https://github.com/hatamiarash7/Mongo-With-Auth/blob/master/LICENSE)   
A Docker Image for MongoDB which makes it easy to create an Admin, a Database and a Database User when the container is first launched.
It's an updated version of [docker-mongo-auth](https://github.com/aashreys/docker-mongo-auth). That's not maintain anymore.
## Customization
There are multiple environment variables which you can specify to customize the username and passwords of your users.
- With Dockerfile
```dockerfile
# ENV AUTH yes# ENV MONGODB_ADMIN_USER admin
# ENV MONGODB_ADMIN_PASS adminpass# ENV MONGODB_APPLICATION_DATABASE testdatabase
# ENV MONGODB_APPLICATION_USER testuser
# ENV MONGODB_APPLICATION_PASS testpass
```
- With docker-compose.yml```yaml
services:
db:
image: hatamiarash7/mongo-auth:latest
environment:
- AUTH=yes
- MONGODB_ADMIN_USER=admin
- MONGODB_ADMIN_PASS=adminpass
- MONGODB_APPLICATION_DATABASE=testdatabase
- MONGODB_APPLICATION_USER=testuser
- MONGODB_APPLICATION_PASS=testpass
```- With command line
```bash
docker run -it \
-e AUTH=yes \
-e MONGODB_ADMIN_USER=admin \
-e MONGODB_ADMIN_PASS=adminpass \
-e MONGODB_APPLICATION_DATABASE=testdatabase \
-e MONGODB_APPLICATION_USER=testuser \
-e MONGODB_APPLICATION_PASS=testpass \
-p 27017:27017 hatamiarash7/mongo-auth:latest
```## Support
[](https://ko-fi.com/D1D1WGU9)
## Contributing
1. Fork it !
2. Create your feature branch : `git checkout -b my-new-feature`
3. Commit your changes : `git commit -am 'Add some feature'`
4. Push to the branch : `git push origin my-new-feature`
5. Submit a pull request :D## Issues
Each project may have many problems. Contributing to the better development of this project by reporting them.