pCloud Partner Program

使用play-with-docker快速建立mongodb測試環境

系統技術 2017/12/29 15:42
views: 24522 times
使用 play with docker: https://play-with-docker.com 可以快速建立 docker container 環境, 每次可以使用 4個小時, 供測試驗證應用.

進入 play with docker 後, 使用以下指令進行 mongodb 的建立:

docker run --name some-mongo -d mongo

當然因為沒有 mongo 的 image, 所以會進行 pull, 並發起一個 container 執行 mongodb.

接下來可以使用 docker ps 來檢查是否已正常執行.

若要進入該 instance 裡, 可以使用以下指令:

docker exec -it some-mongo /bin/bash

就可以進行該 mongo instance 中的 bash 中, 進入 db 的 shell , 可以再下指令: mongo, 即可正常進入該 mongodb 的 shell 中, 接下來就可以使用大家熟悉的 mongo 指令, 如:

use [db_name]
db.createCollection("[collection_name]")
db.[collection_name].insert({xxx})

等指令.




top

Trackback Address :: http://diary.tw/tim/trackback/1191

  1. Tracked from clock parts 2018/01/08 11:01 DELETE

    Subject: clock parts

    Get the best new replacement clock mechanism now now in stock and at the best price but you must get it today!
  2. Tracked from synchronized clocks for schools 2018/01/08 11:56 DELETE

    Subject: synchronized clocks for schools

    Get top school buzzer system that's now in stock and at the best price now!
  3. Tracked from check your url 2018/01/08 17:07 DELETE

    Subject: check your url

    Click now for top metal building erectors that's available and reasonably priced today!
  4. Tracked from browse this site 2018/01/09 01:25 DELETE

    Subject: browse this site

    Click now for top design build contractors that are available now plus reasonably priced today!
  5. Tracked from anchor 2018/01/10 04:03 DELETE

    Subject: anchor

    Click here for professional general contractor that's currently available and reasonably priced today!

Write a comment


PREV : [1] : [2] : [3] : [4] : [5] : ... [475] : NEXT



Nextbit Robin 5.2吋六核心智慧型手機 Microsoft Office 365 中文家用版PKC (無光碟)
ASUS華碩 AC1900 雙頻無線路由器 RT-AC68U 美國 VORNADO 533 渦流空氣循環機 (黑色)
御茶園 每朝健康綠茶(650mlx24入) 每朝健康 雙纖綠茶(650mlx24入)


 Waiting...