简体   繁体   English

Windows 7上的Docker:hello-world在Docker Quickstart Terminal上运行,但不在命令提示符下运行。 为什么?

[英]Docker on windows 7: hello-world runs on Docker Quickstart Terminal but not on command prompt. why?

I haven't been able to run hello-world on command prompt but on quickstart terminal it works. 我无法在命令提示符下运行hello-world,但在quickstart终端上却可以运行。 Why is that? 这是为什么? Error message on command prompt: 命令提示符下的错误消息:

https://drive.google.com/file/d/0B0rw5s9roTIiWnpOM1JhVUNDZVU/view?usp=sharing https://drive.google.com/file/d/0B0rw5s9roTIiWnpOM1JhVUNDZVU/view?usp=sharing

In a broader context, I am trying to run Docker compose to set up a network but unsuccessful. 在更广泛的范围内,我尝试运行Docker compose建立网络,但未成功。 So I figure understanding more about Docker would be helpful. 因此,我认为更多地了解Docker会有所帮助。 Appreciate any pointer. 感谢任何指针。 Thanks! 谢谢!

(Please copy paste the error directly in your post) (请直接将错误复制粘贴到您的帖子中)

From the screenshot, you run this command from Windows system. 在屏幕截图中,您从Windows系统运行此命令。 Did you install docker for windows in your windows system? 您是否在Windows系统中docker for windows安装了docker for windows To do this, you need check if your windows system is good enough to do that. 为此,您需要检查Windows系统是否足够好。 Check Windows versions of Docker Engine, Compose, and Machine 检查Windows版本的Docker Engine,Compose和Machine

If you installed Docker for Windows , then you should be fine to docker run hello-world directly. 如果您安装了Docker for Windows ,则可以直接使用docker run hello-world

Otherwise, you should choice to run with windows base image, lucky Docker company made this. 否则,您应该选择使用Windows基本映像运行,幸运的Docker公司做到了这一点。

docker run run hello-world:nanoserver

You can compare the differences about hello-world:latest and hello-world:nanoserver 您可以比较一下hello-world:latesthello-world:nanoserver

Dockerfile for image hello-world:nanoserver : 用于图像hello-world:nanoserver

FROM microsoft/nanoserver
COPY hello.txt C:
CMD ["cmd", "/C", "type C:\\hello.txt"]

Dockerfile for image hello-world:latest 用于图像hello-world:latest Dockerfile

FROM scratch
COPY hello /
CMD ["/hello"]

Docker is not supported natively on Windows7. Windows7本身不支持Docker。 It run in virtual box 'boot2docker' which provides it a linux environmental. 它在提供Linux环境的虚拟盒'boot2docker'中运行。 The quickstart terminal is a special bash environment instead of the standard Windows command prompt, so you can't run docker commands on Windows command prompt. 快速入门终端是一种特殊的bash环境,而不是标准Windows命令提示符,因此您无法在Windows命令提示符下运行docker命令。

Pointer-> https://docs.docker.com/toolbox/toolbox_install_windows/#what-you-get-and-how-it-works 指针-> https://docs.docker.com/toolbox/toolbox_install_windows/#what-you-get-and-how-it-works

However Docker is natively supported on Windows 10. 但是Windows 10本机支持Docker。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM