简体   繁体   English

延迟启动 docker 容器 - 超过 10 个绑定挂载

[英]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.

相关问题 无法 map 将带有空格的主机目录连接到容器目录(绑定挂载) - Docker 快速入门终端(Bash),windows 10 - Cannot map a host directory with spaces to a container directory (bind mounts) - Docker Quickstart Terminal (Bash), windows 10 使用Docker for Mac时,使用:cached绑定安装时,主机或容器上的延迟是什么? - With Docker for Mac when using :cached bind mounts, are the delays on the host or the container? 适用于Windows的Docker绑定卷在Windows 10中挂载空卷 - Docker for Windows bind volume mounts empty volume in Windows 10 Windows 10绑定在docker-compose中的安装不起作用 - Windows 10 bind mounts in docker-compose not working 启动超过90天的Docker容器 - Starting docker container that is more than 90 days old 基本 Docker 绑定安装故障排除 - Basic Docker Bind Mounts Troubleshooting Bind Mounts 和 Host Volumes 在 Docker 中是一回事吗? - Are Bind Mounts and Host Volumes the same thing in Docker? Jenkins Docker 映像,是否使用绑定安装? - Jenkins Docker image, to use bind mounts or not? Docker:绑定安装未按预期工作 - Docker: bind mounts not working as I expected Docker 中的 Jenkins:关于管道中绑定挂载的说明 - Jenkins in Docker: clarification about bind mounts in pipelines
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM