I'm a newbie to Docker, I have an application for which I am exploring Docker. With docker compose i can up multiple containers, till here everything is working as expected. We have respective .sh and .yml files.
Scenario which I'm having problem to understand is there is one container where I can place my custom directory, files and it's mentioned that at the time of container start/restart custom files will be copied to the webroot of that container. I would like to understand what happened behind the scene.
Any help to understand above scenario is much appreciated. Thanks in advance.
Depends on how you build and run the container. If you have a Dockerfile and in there you specify COPY or ADD /my/files/ /to/container/path this will result in copying /my/files inside the container and it will create a new image layer (each command you run inside the Dockerfile creates a new layer)
This means that it would take a snapshot of your files at that point in time and copy it over to the Docker image.
However, if you just use your docker-compose file and mount those files, the files will be shared between your host and the container. Which means you could edit files on your localhost and immediately sync'ed with the container or vice versa.