How to reuse layers with code in a docker container?
Hello! Is there a repository with PHP code.
I would like to put in server code as container. That is, I want to push to the repository to bildit the container that contains the PHP code of the current version.
The source files are large, about 300 meters.
If I use the COPY instruction in the Dockerfile, if at least one of the thousands of files will change, the next time you build all the code sulgeda as a new layer and take another 300 megabytes.
Question! May be someone faced with similar and knows as to make so that only changes to specific files included in the container, but unchanged files were taken, how can Docker, cache?
You are likely confusing the concept of a container with the image.
At the moment the build is going exactly the way.
From which then the desired machine, you can create a container.
Yes, if you change files in the container, it will grow.
Therefore, if you change the code should bildit a new image with the new code, push to the repository.
And need the car to do a pull from the repository, delete the old container and create a new one.