Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

dockerfile - Docker: Mount directory from one container to another

I have two docker images. One of the docker image (from first container), when ran, generates some files, which needs to be consumed by the another container.

Can I do this?

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

Rene's answer works, but you could share data without using the host's directory (container1 ==> container2):

docker run -v /data/myfolder --name container1 image-name-1
docker run --volumes-from container1 image-name-2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...