Why do I still need to do COPY in my Dockerfile if I'm using a Bind Mount?

坚强是说给别人听的谎言 提交于 2021-01-05 06:22:59

问题


So I'm in a developemnt environment and I'm binding my code inside a container using Mount Bind in my docker-compose file:

...
volumes:
       - ./my-code:/home/node/app    
       - /home/node/app/node_modules
...

But I still need do COPY inside my Dockerfile in order to make this work.

COPY --chown=node:node . .

What I don't get is. If I'm binding my code to the container inside docker-compose.yml, why do I still need to copy all my code in the Dockerfile?

来源:https://stackoverflow.com/questions/62734082/why-do-i-still-need-to-do-copy-in-my-dockerfile-if-im-using-a-bind-mount

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!