nginx – 我的docker容器没有在Docker for Windows(使用Hyper-V的Native)上的localhost(0.0.0.0)上启动

我正在关注如何启动Nginx docker容器的Digital Ocean’s tutorial(目前在第4步).目前这是他们的输出

$docker run --name docker-Nginx -p 80:80 -d Nginx
d3ccb73a91985651ec61231bca9f9c716f0dec807e354a29eeef2144f883a01c

$docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                         NAMES
b91f3ce26553        Nginx               "Nginx -g 'daemon off"   About a minute ago   Up About a minute   0.0.0.0:80->80/tcp,443/tcp   docker-Nginx

但是当我运行它时,这是我的输出(注意到容器的不同IP):

C:\>docker run --name docker-Nginx -p 80:80 -d Nginx
d3ccb73a91985651ec61231bca9f9c716f0dec807e354a29eeef2144f883a01c

C:\>docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                           NAMES
d3ccb73a9198        Nginx               "Nginx -g 'daemon off"   14 hours ago        Up 2 seconds        10.0.75.2:80->80/tcp,443/tcp   docker-Nginx

为什么会这样?我怎样才能获得与Digital Ocean相同的结果? (让服务器在localhost上启动)

编辑:我正在使用Docker for windows(最近发布),显然使用Hyper-V运行本机.我对docker-machine ls的输出是这样的:

C:\>docker-machine ls
NAME   ACTIVE   DRIVER   STATE   URL   SWARM   DOCKER   ERRORS

C:\>

But when I run it,this is my output (noticed the different IP of the
container)

由于这是一台Windows机器,我假设您使用的是Docker ToolBox Docker for Windows. 10.0.75.2是boot2docker虚拟机的IP.

如果您使用的是Windows或Mac OS,则需要使用某种形式的虚拟化
为了运行Docker.您刚看到的IP是该轻量级虚拟机的IP.

And how can I get the same results as Digital Ocean’s? (Getting the
server to start on localhost)

使用Linux发行版!您还可以在Docker For Windows设置中的localhost上启用Expose容器端口:

enter image description here

相关文章

Hyper-V上运行的Linux虚拟机验证是否安装了集成服务 ps aux|...
目录虚拟化介绍虚拟化厂商介绍微软虚拟化发展历程Hyper-v 3....
最近有win10系统用户在开启Hyper-V功能的时候发现无法启动...
Win10系统中的Hyper-V虚拟机组件可以让用户很方便的创建虚拟...
在Win10中使用Hyper-V来创建虚拟机很方便,下面小编就把Hype...
大家都知道Win10家庭版、中文版、普通版和专业版相比是缺少很...