Docker Storage query

In the advance concept of Docker storage I have a query like when we run a container with a custom image we have to layer at that time one is of image layer which is read only and second is container image (Read/Write image) so in video it is said that if we want to make changes in application code then we can’t make in image that is fine but we can make changes in container layer where docker create an image of source code but as in video explanation that while we stop a container all files will be deleted then how it is sync with source code file of image layer and will those changes will reflect? as when container is running our changes are not taken in account we have rebuild the image and rerun the container.

Can you structure your text a bit more. Your text is fairly hard to read because it’s only 2 sentences.

Punctuation matters :wink:

if we make changes in source code in container layer then how it will be sync to our image source code

Or in simple words i am not able to understand copy right mechanism

I think you should google the difference between an image and a container, and how the layers for docker containers/images work.

An image is a blueprint for containers, and that’s why it consists of read-only layers. Otherwise, if containers could modify those layers, it would influence other containers created from the same image.

A container is thus built upon an image, and has all of its files (layers) available at runtime. A container can change files while running (otherwise it wouldn’t be able to do much), but these changes happen in a separate runtime layer. Once the container stops running, these changes are thrown away because the process has done its job and won’t need those files anymore.

So you can´t do this. A running container will never be able to modify the image it’s based on. When you make changes to your house, the architectural plans won’t update either. For containers it’s the same, changes in the container won’t affect the blueprint (image) of that container.

Does that answer your question?

Ok got cleared thanks