官术网_书友最值得收藏!

How to do it...

  1. Download the latest MongoDB Docker image:
docker pull mongo:3.4.4
  1. Check that the image exists:
docker images
  1. Start a container:
docker run -d -v /data/db:/data/db --name mymongo mongo:3.4.4 
  1. Check if the container is running successfully:
docker ps
  1. Let's connect to our mongo server using the mongo client from the container:
docker exec -it mymongo mongo
  1. Stop the mongo instance and with host mode networking:
docker run -d -v /data/db:/data/db --name mymongo --net=host mongo:3.4.4 --bind_ip 127.0.0.1 --port 27000
  1. Connect to the new instance using mongo shell:
docker exec -it mymongo mongo localhost:27000
主站蜘蛛池模板: 桂阳县| 阿克陶县| 临清市| 柳州市| 读书| 电白县| 普兰店市| 渝中区| 枝江市| 云林县| 静乐县| 永修县| 焉耆| 牙克石市| 焉耆| 太仆寺旗| 德庆县| 淳化县| 奎屯市| 五家渠市| 武清区| 嘉兴市| 枣庄市| 五莲县| 柳江县| 万盛区| 吉林省| 右玉县| 长顺县| 开封县| 顺平县| 安西县| 崇阳县| 阿拉善左旗| 凌源市| 雷山县| 霍州市| 库尔勒市| 江安县| 云霄县| 吉木乃县|