2016-11-16 82 views
1

我通过以下示例并阅读文档了解Dockerfile。一个Dockerfile有以下起始行:Dockerfile位置和路径

FROM ubuntu:14.04 
RUN mkdir /home/meteorapp 
WORKDIR /home/meteorapp 
ADD . ./meteorapp 

# Do basic updates 
RUN apt-get update -q && apt-get clean 

# Get curl in order to download what we need 
RUN apt-get install curl -y \ 

    # Install Meteor 
    && (curl https://install.meteor.com/ | sh) \ 

    # Build the Meteor app 
    && cd /home/meteorapp/meteorapp/app \ 
    && meteor build ../build --directory \ 
    # and more lines ... 

线条&& cd /home/meteorapp/meteorapp/app \失败,错误:

/bin/sh: 1: cd: can't cd to /home/meteorapp/meteorapp/app

的Dockerfile坐落在我的应用程序 enter image description here

是什么原因造成的根目录错误和如何解决它?

回答

0

看起来/home/meteorapp/meteorapp/app不存在您的码头集装箱内。

当你ADD . ./meteorapp你把你拥有的一切在你的容器内的Dockerfile文件夹,所以如果你没有一个应用程序文件夹(它似乎是你不,根据您的screenshod),它不会神奇地出现在容器

+0

以及如何解决它?将Dockerfile移出hp文件夹,并将它和hp文件夹放在单独的文件夹中?或更改应用程序为HP? –

+0

我想你可以'cd/home/meteorapp/meteorapp',你会在正确的文件夹中没有? –