docker_practice/appendix/repo/mongodb.md

35 lines
792 B
Go
Raw Normal View History

2018-12-14 19:08:14 +08:00
## [MongoDB](https://hub.docker.com/_/mongo/)
2016-12-10 17:00:25 +08:00
###
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
[MongoDB](https://en.wikipedia.org/wiki/MongoDB) 是开源的 NoSQL 数据库实现。
2018-12-15 23:04:32 +08:00
`https://hub.docker.com/_/mongo/` MongoDB 2.x ~ 4.x
2016-12-10 17:00:25 +08:00
### 使
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
`27017`
2017-11-22 11:13:23 +08:00
```bash
2017-11-24 10:19:15 +08:00
$ docker run --name mongo -d mongo
2016-12-10 17:00:25 +08:00
```
使
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
$ docker run --name some-app --link some-mongo:mongo -d application-that-uses-mongo
```
`mongo`
2017-11-22 11:13:23 +08:00
```bash
2017-12-01 17:32:39 +08:00
$ docker run -it --rm \
--link some-mongo:mongo \
mongo \
sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/test"'
2016-12-10 17:00:25 +08:00
```
### Dockerfile
2017-11-01 00:36:57 +08:00
https://github.com/docker-library/docs/tree/master/mongo 查看。