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

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
主站蜘蛛池模板: 蒲城县| 昌平区| 鲁山县| 多伦县| 武强县| 长顺县| 蓬安县| 蓝山县| 石楼县| 天等县| 桦甸市| 巨鹿县| 当雄县| 德阳市| 即墨市| 鸡东县| 织金县| 金堂县| 庄河市| 德保县| 班玛县| 西丰县| 湾仔区| 福安市| 二手房| 合肥市| 修文县| 简阳市| 湾仔区| 民乐县| 临猗县| 香河县| 崇阳县| 永兴县| 兴海县| 左权县| 台山市| 达孜县| 昌黎县| 奉新县| 桂林市|