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

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
主站蜘蛛池模板: 象州县| 辽宁省| 化隆| 汨罗市| 仁怀市| 仁寿县| 泸溪县| 衡阳市| 肥城市| 许昌市| 济阳县| 肇东市| 延庆县| 荥经县| 通辽市| 襄城县| 桂平市| 申扎县| 西安市| 德清县| 屯门区| 施秉县| 台东市| 吉林省| 周口市| 淅川县| 丰城市| 岑溪市| 綦江县| 玉门市| 昌吉市| 乌审旗| 灵寿县| 湘潭市| 弋阳县| 鄂托克前旗| 黔西县| 昭通市| 眉山市| 丽水市| 镇宁|