Docker:无法访问基础映像的文件夹结构

我有这个形象:

FROM ubuntu:14.04.3 # copy db project to container ADD . /db_project WORKDIR /db_project CMD ["./gitinitall.sh"] 

这将复制当前目录与db项目的内容,它包含git子模块将被检出,并从回购拉。 所以在db_project中是我运行来获取子模块的shell脚本。 也有使用dbs的后端。 图像被推到一个私人回购。

我想使用这个图像来创build一个容器,我需要为需要部署的环境添加数据库的configuration,例如:

 FROM myprivatedockerrepo:5000/db_project ... WORKDIR /db_project COPY config/dev.config /db_project/apps/mydb_db/config/dev.config # get everything needed for backend RUN mix deps.get # expose the backend port EXPOSE backendport # start the beckend with the proper db configured CMD ["./startbeckend"] 

但是它没有运行混合deps.get:

 Step 14/20 : RUN mix deps.get ---> Running in ab7375d69989 warning: path "apps/mydb_db" is a directory but it has no mix.exs. Mix won't consider this directory as part of your umbrella application. Please add a "mix.exs" or set the ":apps" key in your umbrella configuration with all relevant apps names as atoms 

如果我添加一个

 RUN ls apps/mydb_db 

在运行mix命令之前:

 ls: cannot access apps/mydb_db: No such file or directory 

所以看起来虽然在图片上使用了myprivatedockerrepo:5000 / db_project,应该有db_project / apps / mydb_db – 由shell脚本子模块创build的mydb_db从git中获取,找不到,也许我不明白docker的图层?

要复制一个文件夹,你需要添加一个最终的“/”

#Dockerfile ADD。 / db_project /

另请参阅: https : //docs.docker.com/engine/reference/builder/#add

是我的坏,gitinitall.sh脚本获取和更新从git的所有子模块没有工作,因为没有图像中的git设置或ssh键,但它没有返回任何代码,所以它没有显示任何失败。