Docker 来自守护程序的错误响应:错误处理 tar 文件(退出状态 1):设备上没有 space

Docker Error response from daemon: Error processing tar file(exit status 1): no space left on device

我需要从虚拟框图像创建 docker 的图像。该文件是16GB。当我运行命令行# tar -c . | docker import - <myImagename>出现下面这个错误。

P.S。 : 容器是空的。

错误:

Error response from daemon: Error processing tar file(exit status 1): write /var/lib/docker/overlay2/f8bb15057c3b3578c13e1122be1d00ca72b3301b7a0bf27262edc759e9f207fb/diff/var/lib/docker/overlay2/f8bb15057c3b3578c13e1122be1d00ca72b3301b7a0bf27262edc759e9f207fb/diff/var/lib/cassandra/commitlog/CommitLog-6-1633100360364.log: no space left on device

Docker 信息:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.1-docker)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 20.10.8
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e25210fe30a0a703442421b0f60afac609f950a3
 runc version: v1.0.1-0-g4144b63
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1127.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 15.51GiB
 Name: GDBDEV03
 ID: UGGJ:AIIA:7C44:DZXR:PNYH:2WQH:GPKI:TFUL:N2WZ:5RRB:X3JK:VU3B
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

编辑

[root@GDBDEV03 chroot0]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 7.8G     0  7.8G   0% /dev
tmpfs                    7.8G     0  7.8G   0% /dev/shm
tmpfs                    7.8G  8.7M  7.8G   1% /run
tmpfs                    7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/mapper/centos-root   14G   13G  1.3G  91% /
/dev/sda1               1014M  152M  863M  15% /boot
tmpfs                    1.6G     0  1.6G   0% /run/user/0

首先运行docker image prune清理所有悬挂图像

如果这没有帮助您可能需要检查这个答案

Docker error : no space left on device

不清楚您到底想做什么(. 在哪里,这是本地 docker 引擎还是将图像发送到远程节点)。将 VM 映像放入容器映像是一种明显的代码味道(容器不是 VM)。

就是说,根据描述,您有一个 16GB 的文件,您正试图将其打包到一个系统上,而 docker 有 1.3G 可用空间(假设您来自 运行 docker /var/lib/docker)。这在任何条件下都行不通。通常,您需要 2-3 倍的 space 可用于处理打包图层所需的副本。

因此,对于您的根分区,您希望将其从 14GB 扩展到 45GB(13 当前 + 3x16)。扩展分区的步骤取决于您的底层存储和文件系统类型,并且更适合 superuser.SE.

使用来自 Docker Hub 官方图像的基本图像解决了错误,我需要安装它而不是自己创建所有者基本图像。这 post 教会了我很多。我祝贺大家做出贡献。我分离了有助于启动解决方案的提示:

"@LucianaOliveira the suggested way to create an image is using a Dockerfile and docker build, start from a minimal base image (there are many to choose from in Docker Hub's official images), and add your application. It's reproducible and easier to update. VMs package a host, containers package an application, there's no direct translation between the two. – BMitch"