当装载具有大量数据(例如一百万个文件)的卷时,我们正在遇到一些非常奇怪的行为
当前设置:
我尝试了不同版本的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
获得相同的结果;超时,无法正常工作。任何对正确方向的帮助和指导将不胜感激。
答案 0 :(得分:0)
正如我自己的评论中所提到的,这是由于SeLinux和安装时的日期标签所致。为避免此问题,我们不得不关闭标签:
mycontainer:
build: mycontainer
restart: always
# To avoid issue with named volume and mounting time
security_opt:
- "label=disable"
免责声明:我不是100%肯定使用此选项的全部后果,但就我们而言,这是目前解决此问题的可行方法。