mongodb
parent
87ea4a7778
commit
749cab0fe0
@ -0,0 +1,34 @@
|
|||||||
|
# Setup mongo
|
||||||
|
|
||||||
|
1. Start docker
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker-composer up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
2. to enter CLI
|
||||||
|
|
||||||
|
```
|
||||||
|
// check image name
|
||||||
|
$ docker ps
|
||||||
|
|
||||||
|
// enter interactive bash shell
|
||||||
|
$ docker exec -it mongo-5-mongo-1 bash
|
||||||
|
|
||||||
|
// enter to mongo shell
|
||||||
|
$ docker exec -it mongo-5-mongo-1 mongosh "mongodb://root@localhost:27017"
|
||||||
|
```
|
||||||
|
|
||||||
|
3. To test server. Using robo-3t to connect `localhost:27017`. login : `root` password : `example`
|
||||||
|
|
||||||
|
4. Stop server
|
||||||
|
```
|
||||||
|
$ docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Ports
|
||||||
|
|
||||||
|
* 27017 : mongo
|
||||||
|
* 8081 : mongo-express
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
# Use root/example as user/password credentials
|
||||||
|
version: '3.1'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 27017:27017
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: root
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: example
|
||||||
|
|
||||||
|
mongo-express:
|
||||||
|
image: mongo-express
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8081:8081
|
||||||
|
environment:
|
||||||
|
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||||
|
ME_CONFIG_MONGODB_ADMINPASSWORD: example
|
||||||
|
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
|
||||||
Loading…
Reference in New Issue