在码头容器上安装多个卷? [英] Mounting multiple volumes on a docker container?

查看:93
本文介绍了在码头容器上安装多个卷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以在我的主机上挂载一个目录在我的容器上,使用类似于

  docker run -t -i  - v'/ on / my / host:/ on / the / container'ubuntu / bin / bash 

有没有办法创建多个主机 - 容器对?例如一个逗号分隔的列表,或传递一个数组?

解决方案

通过多个 -v 参数。



例如:

  docker  - v / on / my / host / 1:/ on / the / container / 1 \ 
-v / on / my / host / 2:/ on / the / container / 2 \
。 ..


I know I can mount a directory in my host on my container using something like

docker run -t -i -v '/on/my/host:/on/the/container' ubuntu /bin/bash

Is there a way to create more than one host-container pair? e.g. a comma-separated list, or pass in an array?

解决方案

Pass multiple -v arguments.

For instance:

docker -v /on/my/host/1:/on/the/container/1 \
       -v /on/my/host/2:/on/the/container/2 \
       ...

这篇关于在码头容器上安装多个卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆