Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

Docker: How to preserve dir cache from one image to the next?

Suppose I have 3 docker files, each being independently useful.

A.dockerfile
B.dockerfile
C.dockerfile
...
N.dockerfile

And I make them all in the same context:

docker build .. -f A.dockerfile
docker build .. -f B.dockerfile 
docker build .. -f C.dockerfile
...
docker build .. -f N.dockerfile

There is caching at the layer level, yes. But now I have leveraged that caching in a useful way, and suddenly I am back to a saw-tooth of performance: for each of the N dockerfiles, many of which may complete in approximately O(1), I must send the entire context .. (approx. 3 Gb in my case) to the docker daemon every time.

The result is a saw tooth performance, but all the chugging isn't really doing anything -- functionally, I am knitting together different cached layers and cherry picking files from the context... so the vast majority of processing is just byte churn.


Is there any way to continuate the docker context cache some how?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...