---
# System prepended metadata

title: Day 10 - Mongo DB

---

# Day 10 - Mongo DB
# 作業: 請按照本文的步驟，建立一個名為 Cupoy Test 的mongo 運行程序
## 1. Installer MongoDB on docker請按照本文的步驟，建立一個名為 Cupoy Test 的mongo 運行程序
### 在 docker 安裝 mongodb
* 指令: docker pull mongo:latest
![](https://i.imgur.com/x49V7JA.png)


## 2. Create root user
1. Check the download images
![](https://i.imgur.com/ubv6n71.png)
2. Activate the container and connect from port 27017
![](https://i.imgur.com/mCgPzdg.png)
3. Enter mongo shell
pi@raspberrypi:~/docker_test $ docker exec -it mongo mongo admin

![](https://i.imgur.com/f5DdOge.png)



## 3. Connect from outside of the container
1. Enter bash
docker exec -it mongo bash
![](https://i.imgur.com/1CM8idK.png)
2. Open the connection
mongo --port 27017 -u "<user-name>" -p "<password>" --authenticationDatabase "admin" 
![](https://i.imgur.com/2aj3w4R.png)
![](https://i.imgur.com/1U4vqU7.png)


