簡體   English   中英

在 Windows 上安裝 mongoDB 作為 docker 鏡像

[英]Installing mongoDB as a docker image on Windows

我正在嘗試將 mongoDB 作為 docker 映像安裝在 Windows 10 機器上。 到目前為止,這是我使用的過程(在另一台具有相同配置的機器上工作)

docker pull mongo //download the mongo image
docker run -it -d -p 21017:21017 --name mongodb mongo //run it
docker ps //Its right there!
docker exec -it mongodb bash //get the shell command

這是我拋出的錯誤:

container e65c8b920af38b4f93214c81a89bcb2337c95ae27fe84efcd38dae0df3b635fe encountered an error during CreateProcess: failure in a Windows system call: System could not find the file. (0x2)

[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"bash","WorkingDirectory":"/","Environment":{"MONGO_DOWNLOAD_SHA256":"c4574977ea850798329bfdb6e912145f683afd3b28fe363abdf51ead33446a94","MONGO_DOWNLOAD_URL":"https://downloads.mongodb.org/win32/mongodb-win32-x86_64-2012plus-4.2.2-signed.msi","MONGO_VERSION":"4.2.2"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[0,0]}

我嘗試過的事情:

  • 以管理員身份執行。
  • 刪除它並重復docker rm mongodb並返回到第一步
  • 另一個拉(它說它是最新的)

這些都沒有奏效,所以我錯過了一些大的東西或者它的錯誤。 我讀過另一篇文章,但那些與構建應用程序和 C# 相關的文章不是我想要的。

注意: - 操作系統:Windows 10 專業版 - 我是新手,獨自學習

謝謝你的時間

編輯:

蒙戈圖像

在閱讀了幾天的文檔並學習了有關 docker 的新知識后,我將回答我自己的問題。

答案非常簡單,它針對那些在 Windows 操作系統上使用 Docker Dektop 並希望使用 bash 並因此遇到與我類似的問題的人。

首先,停止你試圖一遍又一遍地運行失敗的圖像並殺死它。

轉到屏幕左下角的那個泊塢窗圖標。

點擊福克圖標

右鍵單擊它並選擇“切換到 Linux 容器”

等待幾秒鍾的切換,然后重復您用於運行和使用 bash 執行 mongodb 的命令。

此錯誤背后的原因是您嘗試在 Windows 容器上使用 bash!

刪除與 mongo 相關的所有圖像以及懸空圖像。 然后嘗試再次拉取 mongo,然后再運行容器。

運行此命令刪除所有圖像

docker system prune -a

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM