我有这张图片:
FROM ubuntu:14.04.3
# copy db project to container
ADD . /db_project
WORKDIR /db_project
CMD ["./gitinitall.sh"]
这将使用db项目复制当前目录的内容,该项目包含git子模块,这些子模块将从repo中检出并拉出。所以在db_project中是我运行以获取子模块的shell脚本。还有使用dbs的后端。图像被推送到私人仓库。
我想使用此图像创建一个容器,我需要为需要部署的环境添加数据库的配置,例如:
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脚本子模块创建的mydb_db从git获取,它找不到它,也许我不了解docker层或其他东西?
答案 0 :(得分:1)
要复制文件夹,您需要添加最终的'/'
#Dockerfile 添加/ db_project /
答案 1 :(得分:0)
我的不好, 从git获取和更新所有子模块的gitinitall.sh脚本不起作用,因为图像中没有git设置或ssh键,但它没有返回任何代码,因此它没有显示失败。