我正在尝试在 Windows 10 计算机上将 mongoDB 作为 docker 镜像安装。到目前为止,这就是我使用的过程(它在具有相同配置的另一台机器上运行)
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 并因此遇到与我类似的问题的人。
首先,停止您试图一遍又一遍地运行但不成功的镜像并将其杀死。
前往屏幕左下角的 docker 图标。
右键单击它并选择“切换到 Linux 容器”
等待几秒钟进行切换,然后使用 bash 重复用于运行和执行 mongodb 的命令。
此错误背后的原因是您正在尝试在 Windows 容器上使用 bash!
关于java - 在Windows上将mongoDB安装为docker镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59848622/