Docker ONBUILD COPY doesn't seem to copy files
当我执行docker build命令时,我正在尝试将文件复制到docker映像。我不确定我做错了什么,因为这似乎适用于Docker Rails onBuild文件,但不适用于我的自定义DockerFile。
这是我的码头文件
1 2 3 4 5 6 7 8 | FROM ubuntu:14.04 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app ONBUILD COPY Gemfile /usr/src/app CMD ["tail","-f","/dev/null"] |
我运行的docker命令如下。
1 2 3 | docker build -t copy-test . docker run --name run-test -d copy-test docker exec -i -t 2e9adebae0fc /bin/bash |
当我用docker exec连接到容器时,它从
你必须用
见Docker文件:
The ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build. The trigger will be executed in the context of the downstream build, as if it had been inserted immediately after the FROM instruction in the downstream Dockerfile.