'Is it possible to split a layer of an existing docker image?
Part of creating a docker image includes running a product install. This product install creates a thick layer of over 10GB. Having such a thick layer creates challenges when pushing the image to the repository. Is there a way to break down an existing image layer into multiples? More specifically, expand the layer on the filesystem, and then create new layers based on subfolders?
Solution 1:[1]
I ended up doing the following:
- Run the base container
- Using exec, installed the product fully in the running container.
- Moved a very large folder to a mounted volume, making the core smaller.
- Making a snapshot of the running container into an image.
- Running the new image.
- Restoring the removed folder from the mounted volume.
- Captured the running image as the final production image.
The above has helped me to turn a 12GB layer into two of 6GB and eliminate issues that I faced when pushing a very thick layer of 12GB.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user1015767 |
