2016-11-16 606 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',你會在正確的文件夾中沒有? –