Hi, excellent tutorial, everything worked like a charm. Just one question, why one-way volumes? Exactly how do they work and how to make good use of them? (Well, 3 actually)
Thanks. The only time I use on-way volumes is for managing the node_modules directory. I don't know the internals well, but with a two-way volume, when you run docker-compose up, docker takes the files on your machine and inserts them in the newly-started container, overwriting any equivalent files that were in your image. This is usually what you want, so you don't have to rebuild the image every time you change your code, but the whole point of installing dependencies in an image is that they are independent of the machine running the container. Using a one-way volume prevents the node_modules directory on your computer from replacing the one in your docker image.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, excellent tutorial, everything worked like a charm. Just one question, why one-way volumes? Exactly how do they work and how to make good use of them? (Well, 3 actually)
Thanks!
Thanks. The only time I use on-way volumes is for managing the
node_modules
directory. I don't know the internals well, but with a two-way volume, when you rundocker-compose up
, docker takes the files on your machine and inserts them in the newly-started container, overwriting any equivalent files that were in your image. This is usually what you want, so you don't have to rebuild the image every time you change your code, but the whole point of installing dependencies in an image is that they are independent of the machine running the container. Using a one-way volume prevents thenode_modules
directory on your computer from replacing the one in your docker image.