docker_practice/appendix/repo/mongodb.md
Kang HuaiShuai 5cb92f63cf
Update title style
Signed-off-by: Kang HuaiShuai <khs1994@khs1994.com>
2019-11-06 14:58:03 +08:00

35 lines
788 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# [MongoDB](https://hub.docker.com/_/mongo/)
## 基本信息
[MongoDB](https://en.wikipedia.org/wiki/MongoDB) 是开源的 NoSQL 数据库实现。
该仓库位于 `https://hub.docker.com/_/mongo/` 提供了 MongoDB 2.x ~ 4.x 各个版本的镜像
## 使用方法
默认会在 `27017` 端口启动数据库
```bash
$ docker run --name mongo -d mongo
```
使用其他应用连接到容器可以用
```bash
$ docker run --name some-app --link some-mongo:mongo -d application-that-uses-mongo
```
或者通过 `mongo`
```bash
$ docker run -it --rm \
--link some-mongo:mongo \
mongo \
sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/test"'
```
## Dockerfile
请到 https://github.com/docker-library/docs/tree/master/mongo 查看。