Docker – 正确安装Docker容器中的主机目录(Windows)

我在将我的机器上的目录挂载到Docker容器时遇到了一些麻烦。 我想挂载一个包含运行节点服务器所需文件的目录。 到目前为止,我已经成功地使用下面的Dockerfile在浏览器中运行和访问我的服务器:

# Use an ubuntu base image FROM ubuntu:14.04 # Install Node.js and npm (this will install the latest version for ubuntu) RUN apt-get update RUN apt-get -y install curl RUN curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash - RUN apt-get -y install nodejs RUN apt-get -y install git # Bundle app source (note: all of my configuration files/folders are in the current directory along with the Dockerfile) COPY . /src Install app dependencies #WORKDIR /src RUN npm install RUN npm install -g bower RUN bower install --allow-root RUN npm install -g grunt RUN npm install -g grunt-cli #What port to expose? EXPOSE 1234 #Run grunt on container start CMD grunt 

而这些命令:

 docker build -t test/test . docker run -p 1234:1234 -d test/test 

然而,我想我想configuration文件和什么不坚持,并认为通过挂载目录(与文件和Dockerfile)作为一个卷。 我用StackOverflow上的其他解决scheme来获得这个命令:

 docker run -p 1234:1234 -v //c/Users/username/directory:/src -d test/test 

我的节点服务器似乎启动正常(在日志中没有错误),但它需要更长的时间,当我尝试访问我的网页在浏览器中,我只是得到一个空白页面。

我做错了什么吗?

编辑 :我已经得到我的服务器运行 – 似乎是我的configuration奇怪的错误。 但是,从我的主机上挂载卷时,启动服务器需要很长时间(大约一两分钟)。 有没有人有一些见解,为什么这是?