[英]Delay in starting the docker container - More than 10 bind mounts
I am trying to run a perl script inside the container.我正在尝试在容器内运行 perl 脚本。 The script will be accessing more than 10 servers for read and write purposes.
该脚本将访问 10 多个服务器以进行读写。 The servers are present both in local and other countries.
服务器存在于本地和其他国家/地区。 So while running the docker image, i am bind mounting all the volumes.
因此,在运行 docker 映像时,我正在绑定安装所有卷。 This in turn causes huge delay in starting the container.
这反过来会导致启动容器的巨大延迟。
Is there any optimal way to handle this scenario?是否有任何最佳方法来处理这种情况? Is it possible to pre-mount those volumes before starting the container (like mounting during docker build)?
是否可以在启动容器之前预先安装这些卷(例如在 docker 构建期间安装)?
During docker build you can't mount anything because you essentially building image which can be ran anywhere - on any docker/kubernetes cluster.在 docker 构建期间,您无法安装任何东西,因为您实际上构建了可以在任何地方运行的映像 - 在任何 docker/kubernetes 集群上。 so mount make sense only during run command.
因此 mount 仅在运行命令期间才有意义。
you can try creating nfs (or just local volume) volume in advance and mount it by name during run.您可以尝试提前创建 nfs(或仅本地卷)卷并在运行期间按名称挂载它。 it may be faster just because volume is already created.
它可能会更快,因为已经创建了卷。 here is a doc: https://docs.docker.com/engine/reference/commandline/volume_create/ search for
--opt type=nfs
and here is how to use created volume: https://docs.docker.com/storage/volumes/#start-a-container-with-a-volume here is a doc: https://docs.docker.com/engine/reference/commandline/volume_create/ search for
--opt type=nfs
and here is how to use created volume: https://docs.docker.com/存储/卷/#start-a-container-with-a-volume
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.