简体   繁体   English

Arch Linux,Docker“设备上没有剩余空间。”

[英]Arch Linux, Docker “No space left on device.”

All of the similar questions I see are resolved by cleaning up the images or containers or orphaned volumes but I am not having any of those problems. 我看到的所有类似问题都可以通过清理图像或容器或孤立卷来解决,但我没有任何这些问题。 I even completely deleted /var/lib/docker and still nothing. 我什至完全删除了/var/lib/docker而仍然一无所获。

Relevant output: 相关输出:

[N] ⋊> ~/W/W/cocagne on master ⨯ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /var/lib/docker:/var/lib/docker martin/docker-cleanup-vol
umes
docker: Error response from daemon: Container command '/usr/local/bin/docker-cleanup-volumes.sh' not found or does not exist..
[N] ⋊> ~/W/W/cocagne on master ⨯ docker-compose build                                                                                                11:56:23
mysql uses an image, skipping
Building vitess
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.7.1', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python3.5/site-packages/compose/cli/main.py", line 58, in main
    command()
  File "/usr/lib/python3.5/site-packages/compose/cli/main.py", line 109, in perform_command
    handler(command, command_options)
  File "/usr/lib/python3.5/site-packages/compose/cli/main.py", line 213, in build
    force_rm=bool(options.get('--force-rm', False)))
  File "/usr/lib/python3.5/site-packages/compose/project.py", line 300, in build
    service.build(no_cache, pull, force_rm)
  File "/usr/lib/python3.5/site-packages/compose/service.py", line 718, in build
    buildargs=build_opts.get('args', None),
  File "/usr/lib/python3.5/site-packages/docker/api/build.py", line 54, in build
    path, exclude=exclude, dockerfile=dockerfile, gzip=gzip
  File "/usr/lib/python3.5/site-packages/docker/utils/utils.py", line 103, in tar
    t.add(os.path.join(root, path), arcname=path, recursive=False)
  File "/usr/lib/python3.5/tarfile.py", line 1938, in add
    self.addfile(tarinfo, f)
  File "/usr/lib/python3.5/tarfile.py", line 1966, in addfile
    copyfileobj(fileobj, self.fileobj, tarinfo.size)
  File "/usr/lib/python3.5/tarfile.py", line 244, in copyfileobj
    dst.write(buf)
  File "/usr/lib/python3.5/tempfile.py", line 483, in func_wrapper
    return func(*args, **kwargs)
OSError: [Errno 28] No space left on device
[I] ⋊> ~/W/W/cocagne on master ⨯ docker ps -a                                                                                                        11:56:30
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[I] ⋊> ~/W/W/cocagne on master ⨯ docker ps -q                                                                                                        11:57:25
[I] ⋊> ~/W/W/cocagne on master ⨯ docker image -q                                                                                                     11:57:28
docker: 'image' is not a docker command.
See 'docker --help'.
[I] ⋊> ~/W/W/cocagne on master ⨯ docker images -a                                                                                                    11:57:39
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
martin/docker-cleanup-volumes   latest              8c41df286c03        12 weeks ago        22.12 MB
[I] ⋊> ~/W/W/cocagne on master ⨯ df -h                                                                                                               11:57:41
Filesystem      Size  Used Avail Use% Mounted on
dev             3.9G     0  3.9G   0% /dev
run             3.9G  832K  3.9G   1% /run
/dev/sda4        27G  9.1G   17G  36% /
tmpfs           3.9G   64M  3.8G   2% /dev/shm
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           3.9G   32K  3.9G   1% /tmp
/dev/sda1        42G   16G   25G  39% /home
/dev/sda2        42G  9.4G   30G  24% /var
/dev/sda5       1.3G   32M  1.3G   3% /boot
tmpfs           790M   12K  790M   1% /run/user/1000
[I] ⋊> ~/W/W/cocagne on master ⨯                                                                                                                     11:57:54

docker info 码头工人信息

[I] ⋊> ~/W/W/cocagne on master ⨯ docker info                                                                                                         12:01:55
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.11.2
Storage Driver: devicemapper
 Pool Name: docker-8:2-2359321-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 11.8 MB
 Data Space Total: 107.4 GB
 Data Space Available: 34.57 GB
 Metadata Space Used: 581.6 kB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.147 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.131 (2016-07-15)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: null host bridge
Kernel Version: 4.6.4-1-ARCH
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.706 GiB
Name: crockford
ID: HO2U:ELWR:LDB3:PMEY:5YOJ:D7YJ:2HJA:PVYG:45K2:J6KI:D6WO:4RUE
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/

One thing that makes my issue a little different (Where I think the root of the issue comes from) 一件事使我的问题有所不同(我认为问题的根源来自哪里)

Before I created a separate partition for /var , it was on my root partition, which eventually maxed out. 在为/var创建单独的分区之前,该分区位于我的根分区上,该分区最终已用完。 Once it maxed out, I shrunk my home partition, create a /var partition, copied my root's /var to my new /var , and removed my old /var . 一旦达到极限,我将缩小主分区,创建/ var分区,将根目录的/var复制到新的/var ,并删除旧的/var But for some reason, docker still think's it's maxed out? 但是出于某种原因,码头工人仍然认为它已经用完了吗? I have no idea. 我不知道。

I also tried to resinstall docker with sudo pacman -S docker but nothing. 我还尝试使用sudo pacman -S docker docker重新安装docker,但是什么也没有。

Edit: I just tried it with a normal docker build . 编辑:我只是用普通的docker build .尝试过docker build . and that works fine. 而且效果很好。 Somehow docker-compose thinks it's out of memory though? docker-compose是否以某种方式认为内存不足?

The python stack trace from docker-compose indicates that it can't seem to create a temporary file. 来自docker-compose的python堆栈跟踪表明它似乎无法创建临时文件。 This would indicate there's no space left in /tmp . 这表示/tmp没有剩余空间。

OP mentioned that his RAM is completely consumed when he runs docker-compose in the comments. OP在评论中提到当他运行docker-compose时,他的RAM已被完全消耗。 Given that and the fact that /tmp is mounted on tmpfs it makes sense that there is no space left for Python/ docker-compose to create any temporary files in /tmp . 考虑到这一点,并且/tmp已安装在tmpfs上,这是有道理的,Python / docker-compose没有空间在/tmp创建任何临时文件。

The possible solutions are: 可能的解决方案是:

  • Temporarily switch the default tempfile generation location by setting one of the following environment variables: TMPDIR , TEMP , TMP (ref: Python doc ) 通过设置以下环境变量之一来临时切换默认的tempfile生成位置: TMPDIRTEMPTMP (参考: Python doc
  • Change /tmp to not use tmpfs and use disk instead. /tmp更改为使用tmpfs ,而是使用磁盘。
  • Increase the amount of RAM/Swap space on your machine. 增加计算机上的RAM /交换空间。 (You can increase swap without messing with your partitions like so ). (您可以增加交换而不会像这样弄乱您的分区)。 tmpfs is backed by volatile storage, which means both RAM and Swap should theoretically work. tmpfs由易失性存储支持,这意味着RAM和Swap在理论上都应该起作用。

Note, most of these cases will result in a slowdown of your application, especially if the docker build process is I/O heavy. 请注意,这些情况中的大多数都会导致应用程序速度变慢,尤其是在docker构建过程的I / O繁重的情况下。

尝试这个:

mount -o remount,size=4G,noatime /tmp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM