Docker: Mount directory from one container to another

前端 未结 3 1547
执笔经年
执笔经年 2020-12-15 03:42

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

3条回答
  •  有刺的猬
    2020-12-15 04:31

    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
    

提交回复
热议问题