mirror of
https://github.com/vimagick/dockerfiles.git
synced 2024-12-25 02:04:06 +02:00
add mongo
This commit is contained in:
parent
1f85814e91
commit
018264c6d2
@ -112,6 +112,7 @@ dockerfiles
|
||||
- [x] gliderlabs/registrator
|
||||
- [ ] jenkins
|
||||
- [x] letsencrypt
|
||||
- [x] mongo
|
||||
- [x] owncloud
|
||||
- [x] rocket.chat
|
||||
- [x] scrapinghub/splash
|
||||
|
53
mongo/README.md
Normal file
53
mongo/README.md
Normal file
@ -0,0 +1,53 @@
|
||||
mongo
|
||||
=====
|
||||
|
||||
[MongoDB][1] is an open-source, document database designed for ease of development and scaling.
|
||||
|
||||
## docker-compose.yml
|
||||
|
||||
```yaml
|
||||
mongo:
|
||||
image: mongo
|
||||
command: --auth
|
||||
container_name: mongo
|
||||
ports:
|
||||
- "27017:27017"
|
||||
restart: always
|
||||
```
|
||||
|
||||
## up and running
|
||||
|
||||
```bash
|
||||
$ pwgen -1 8 2
|
||||
pah4Xa0o
|
||||
Aedahwa7
|
||||
|
||||
$ cd ~/fig/mongo/
|
||||
|
||||
$ docker-compose up -d
|
||||
|
||||
$ docker exec -it mongo bash
|
||||
/# mongo
|
||||
> use admin
|
||||
> db.createUser({user: 'root', pwd: 'pah4Xa0o', roles: [{role: 'userAdminAnyDatabase', db: 'admin'}]})
|
||||
> db.auth('root', 'pah4Xa0o')
|
||||
> db.runCommand({usersInfo: 1})
|
||||
> exit
|
||||
/# exit
|
||||
|
||||
$ docker cp mongo:/usr/bin/mongo /usr/local/bin/
|
||||
|
||||
$ mongo mongodb://root:pah4Xa0o@localhost:27017/admin
|
||||
> use mydb
|
||||
> db.createUser({user: 'myuser', pwd: 'Aedahwa7', roles: [{role: 'readWrite', db: 'mydb'}]})
|
||||
> exit
|
||||
|
||||
$ mongo mongodb://myuser:Aedahwa7@localhost:27017/mydb
|
||||
> show collections
|
||||
> exit
|
||||
```
|
||||
|
||||
Read [this][2] for more help.
|
||||
|
||||
[1]: https://www.mongodb.org/
|
||||
[2]: https://docs.mongodb.org/manual/tutorial/enable-authentication/
|
7
mongo/docker-compose.yml
Normal file
7
mongo/docker-compose.yml
Normal file
@ -0,0 +1,7 @@
|
||||
mongo:
|
||||
image: mongo
|
||||
command: --auth
|
||||
container_name: mongo
|
||||
ports:
|
||||
- "27017:27017"
|
||||
restart: always
|
Loading…
Reference in New Issue
Block a user