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

Viewed 597

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?

0 Answers
Related