I'm starting to use Docker for projects, and most of these projects run in PHP (some in Nginx / PHP-FPM, some in Apache / PHP as a module).
The fact is, my brain cannot figure out when to use the ADD and VOLUME directives in the Docker file for paths containing the source code.
Here I want to: change the line of code, access the browser in the container port and see the changes. And so on, until everything works as expected, and then I will “add” the code to the machine and distribute it. I think Docker works. I am wrong?
AFAIK, the ADD directive copies files at a given path to the image, and the VOLUME directive simply says that this path will be set by me on the host.
Things that reach me reach me:
Add the source code files through ADD, and then enter the -v command at a command prompt to mount the source code in the same path as in ADD.
Use VOLUME and process two different Dockerfiles: for container development, and for testing / development and building each as needed (this thing, I think, is counterproductive, and my heart tells me that it should not work that way).
Can someone help me? What does my brain not understand, and should I (and understand) use my Docker knowledge?
ehriq source
share