可用磁盘空间低于阈值。可用:0个字节的Docker容器

时间:2019-09-04 07:05:01

标签: docker

我的微服务状态为关闭,我登录到Docker容器:

docker exec -it {container_id} /bin/bash

容器中的应用记录日志输出:

2019-09-04 14:51:02.244  INFO 61 --- [DiscoveryClient-CacheRefreshExecutor-0] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2019-09-04 14:51:02.244  INFO 61 --- [DiscoveryClient-CacheRefreshExecutor-0] com.netflix.discovery.DiscoveryClient    : Application is null : false
2019-09-04 14:51:02.244  INFO 61 --- [DiscoveryClient-CacheRefreshExecutor-0] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2019-09-04 14:51:02.244  INFO 61 --- [DiscoveryClient-CacheRefreshExecutor-0] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2019-09-04 14:51:02.244  INFO 61 --- [DiscoveryClient-CacheRefreshExecutor-0] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2019-09-04 14:51:02.326  INFO 61 --- [DiscoveryClient-HeartbeatExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_APOLLO-ADMINSERVICE/b24984e8c669:apollo-adminservice:8090 - Re-registering apps/APOLLO-ADMINSERVICE
2019-09-04 14:51:02.326  INFO 61 --- [DiscoveryClient-HeartbeatExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_APOLLO-ADMINSERVICE/b24984e8c669:apollo-adminservice:8090: registering service...
2019-09-04 14:51:02.470  INFO 61 --- [DiscoveryClient-HeartbeatExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_APOLLO-ADMINSERVICE/b24984e8c669:apollo-adminservice:8090 - registration status: 204
2019-09-04 14:51:02.485  INFO 61 --- [DiscoveryClient-CacheRefreshExecutor-0] com.netflix.discovery.DiscoveryClient    : The response status is 200
2019-09-04 14:51:02.747  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:51:32.068  INFO 61 --- [AsyncResolver-bootstrap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-09-04 14:51:32.802  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:52:02.857  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:52:32.069  INFO 61 --- [AsyncResolver-bootstrap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-09-04 14:52:32.912  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:53:02.968  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:53:32.070  INFO 61 --- [AsyncResolver-bootstrap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-09-04 14:53:33.026  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:54:03.083  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:54:32.071  INFO 61 --- [AsyncResolver-bootstrap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-09-04 14:54:33.149  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:55:03.247  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:55:32.072  INFO 61 --- [AsyncResolver-bootstrap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-09-04 14:55:33.306  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:56:03.360  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
2019-09-04 14:56:32.074  INFO 61 --- [AsyncResolver-bootstrap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-09-04 14:56:33.417  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)
tail: unrecognized file system type 0x794c7630 for ‘apollo-adminservice.log’. please report this to bug-coreutils@gnu.org. reverting to polling
2019-09-04 14:57:03.558  WARN 61 --- [DiscoveryClient-InstanceInfoReplicator-0] o.s.b.a.system.DiskSpaceHealthIndicator  : Free disk space below threshold. Available: 0 bytes (threshold: 10485760 bytes)

然后我检出容器磁盘:

root@b24984e8c669:/opt/logs/100003172# df -lh
Filesystem      Size  Used Avail Use% Mounted on
overlay          40G   38G     0 100% /
tmpfs            64M     0   64M   0% /dev
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/vda1        40G   38G     0 100% /etc/hosts
shm              64M     0   64M   0% /dev/shm
tmpfs           7.8G     0  7.8G   0% /proc/acpi
tmpfs           7.8G     0  7.8G   0% /proc/scsi
tmpfs           7.8G     0  7.8G   0% /sys/firmware

我该怎么办才能解决问题?如何调整容器磁盘使用率?谢谢!

1 个答案:

答案 0 :(得分:0)

  

如何调整容器磁盘的使用情况?

实际上,这与容器磁盘的使用无关,与您的Docker主机的磁盘的使用无关。

如果在主机上使用docker info | grep Dir进行查看,您会看到类似next的内容:

Docker Root Dir: /var/lib/docker

此文件夹是用于所有容器的叠加文件系统docker。

因此,overlay 40G 38G 0 100% /仅表示/var/lib/docker的主机磁盘已满。您的40G分区还不够,下一步是您可以做的:

选项1:

如果您有其他大于40G的分区,请更改docker的存储位置,例如this

选项2:

仅在当前磁盘(40G)上释放一些空间(删除未使用的大图片,文档,安装程序等)。另外,我想您可能有很多未使用的图像和容器,然后可以使用docker system prune -a对其进行清理。但是请注意下一个:

  

警告!这将删除:
          -所有停止的容器
          -至少一个容器未使用的所有网络
          -所有没有至少与之关联的容器的图像
          -所有构建缓存