[在装载具有大量数据(例如一百万个文件)的卷时,我们遇到一些非常奇怪的行为
当前设置:
我尝试了不同版本的Docker和CoreO,无论新旧版本都没有任何差异。docker-host上的数据目录可能已映射到某些存储技术,我不确定此处的设置,但是如有必要,我可以填写详细信息,但从我的角度来看,它看起来像是普通文件夹。
最初的错误发生在从通过虚拟容器(docker-compose v1)安装的匿名卷切换到命名卷(docker-compose v3)时。创建命名卷后,我关闭docker-service并手动将文件从旧卷复制到新卷。这已经通过少量数据进行了测试,并且可以正常工作,因此内部/ var / lib / docker-domain中的实际移动数据似乎没有问题。我还可以通过复制大量数据的新安装来重新创建此问题。
使用compose构建容器效果很好:
myservice:
build: myservice
restart: always
ports:
- "8080:8080"
volumes:
- type: volume
source: repo
target: /home/repo
volumes:
repo:
回购卷是指包含大量数据的卷。现在,当尝试启动服务时,我的启动超时,服务陷入“已创建”状态:
ERROR: for my-servce-new_exp_1 HTTPSConnectionPool(host='xxxx.xx.xxx.xxx', port=2376): Read timed out. (read timeout=60)
ERROR: for exp HTTPSConnectionPool(host='xxx.xx.xxx.xxx', port=2376): Read timed out. (read timeout=60)
ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).
我已经尝试增加超时时间,但是一段时间后又得到另一个超时时间。
现在,如果我现在重新启动docker-service或主机,则该服务正在启动并运行(但是这样做会导致服务之间的内部dns映射出现问题)
如果我使用空/小容量启动该服务,则它将按预期工作。
出于好奇,我试图将同一卷安装到docker-container时发现一些可能释放的东西:
docker run -it --rm --name rmytest --volume my-service-new_repo:/data ubuntu:latest
这会在30分钟左右后超时。
另一方面,如果我在卷映射的一致性参数中添加了任何选项,它将在几秒钟内运行:
docker run -it --rm --name rmytest --volume my-service-new_repo:/data:consistent ubuntu:latest
我也没有成功将相同的选项添加到撰写文件中,例如
volumes:
- type: volume
source: repo
target: /home/repo
consistency: delegated
获得相同的结果;超时,无法正常工作。向正确方向提供的任何帮助和指导将不胜感激。
mycontainer:
build: mycontainer
restart: always
# To avoid issue with named volume and mounting time
security_opt:
- "label=disable"
免责声明:我不是100%肯定使用此选项的全部后果,但是在我们这种情况下,这是暂时解决此问题的可行方法。