Every layer, of the image is RO except the top RW container layer and any volume mounts that are outside of the layered filesystem. If you download lots of files in the first layer, and delete them in the second layer (container running on top of the first layer), the second layer contains a delete command, but the files still exist in the first layer. You can see the results of this with docker diff
:
$ docker run -it --name busytest busybox
/ # echo "hello world" >/root/test.txt
/ # rm /bin/rpm
/ # rm /bin/timeout
/ # rm /bin/wall
/ # exit
$ docker diff busytest
C /bin
D /bin/rpm
D /bin/timeout
D /bin/wall
C /root
A /root/.ash_history
A /root/test.txt
The diff is the contents of the RO layer of the container. And when you build an image, each RUN command generates a layer from this that is stored as part of your final image.