无法运行Docker容器导致的设备映射错误

时间:2022-04-10 00:22:58

I just can't create and run new containers in Docker anymore. But in the same time a can run previously created containers.

我再也不能在Docker中创建和运行新的容器了。但与此同时,a可以运行以前创建的容器。

When I try to do something like this:

当我尝试这样做的时候:

[user@host ~ ] docker run --name=fpm-5.3 debian:jessie
2014/07/12 07:34:08 Error: Error running DeviceCreate (createSnapDevice) dm_task_run failed

From docker.log:

从docker.log:

2014/07/12 05:57:11 POST /v1.12/containers/create?name=fpm-5.3
[f56fcb6f] +job create(fpm-5.3)
Error running DeviceCreate (createSnapDevice) dm_task_run failed
[f56fcb6f] -job create(fpm-5.3) = ERR (1)
[error] server.go:1025 Error: Error running DeviceCreate (createSnapDevice) dm_task_run failed
[error] server.go:90 HTTP Error: statusCode=500 Error running DeviceCreate (createSnapDevice) dm_task_run failed

dmsetup status

dmsetup状态

docker-8:1-1210426-pool: 0 209715200 thin-pool 352 2510/524288 205173/1638400 - ro discard_passdown queue_if_no_space 

But they are a lot of free space on disk.

但是它们在磁盘上有很多空闲空间。

dmsetup info

dmsetup信息

Name:              docker-8:1-1210426-pool
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        1
Event number:      1
Major, minor:      252, 0
Number of targets: 1

docker info

码头工人信息

Containers: 4
Images: 65
Storage Driver: devicemapper
 Pool Name: docker-8:1-1210426-pool
 Data file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 12823.3 Mb
 Data Space Total: 102400.0 Mb
 Metadata Space Used: 9.9 Mb
 Metadata Space Total: 2048.0 Mb
Execution Driver: native-0.2
Kernel Version: 3.14.4

docker version

码头工人版本

Client version: 1.0.0
Client API version: 1.12
Go version (client): go1.2.2
Git commit (client): 63fe64c
Server version: 1.0.0
Server API version: 1.12
Go version (server): go1.2.2
Git commit (server): 63fe64c

5 个解决方案

#1


30  

The following is for a Fedora/RHEL system, so you'll need to adjust for Debian...

下面是Fedora/RHEL系统,因此您需要调整Debian…

# systemctl stop docker.service
# thin_check /var/lib/docker/devicemapper/devicemapper/metadata

If there were no errors then proceed with:

如果没有错误,则继续:

# thin_check --clear-needs-check-flag /var/lib/docker/devicemapper/devicemapper/metadata
# systemctl start docker.service
# docker run --name=fpm-5.3 debian:jessie

#2


5  

When the docker partition filled and docker would no longer start after reboot, I encountered this:

当docker分区被填满,并且在重新启动之后docker将不再启动时,我遇到了以下情况:

# thin_check /var/lib/docker/devicemapper/devicemapper/metadata
examining superblock
examining devices tree
  missing devices: [0, -]
    bad checksum in btree node
examining mapping tree
  thin device 72 is missing mappings [137494, 137594]
    bad checksum in btree node
  thin device 72 is missing mappings [137721, -]
    bad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree node

I was able to repair with this procedure:

我可以用这个程序进行修复:

# thin_dump -r /var/lib/docker/devicemapper/devicemapper/metadata -o /tmp/metadata.xml
# thin_restore -i /tmp/metadata.xml -o /var/lib/docker/devicemapper/devicemapper/metadata

#3


1  

I had the same problem and was not able to fix it. I found something promising at: http://grokbase.com/t/gg/docker-user/1563fzdtm7/docker-docker-runs-out-of-space-when-trying-to-create-a-new-image 'The default docker storage driver allocates 10GB storage blocks for your images. Move to overlayfs and avoid this entirely. In the command that starts your docker daemon just add "-s overlay" '

我遇到了同样的问题,无法解决。我在http://grokbase.com/t/gg/docker- user/1563fdoczdtm7 /docker- runos -out- when- tryto -create-a-new-image上发现了一些有希望的东西:默认的docker存储驱动程序为图像分配了10GB的存储块。移动到overlayfs,并完全避免这一点。在启动docker守护进程的命令中,只需添加“-s叠加”。

this fixed my problem.

这个固定我的问题。

#4


1  

I've been fighting this issue with Debian 8.2. I had other problems because I run a 4.3.3 Kernel (default is 3.16) with grsec.

我和Debian 8.2一直在争论这个问题。我还有其他问题,因为我使用grsec运行了4.3.3内核(默认值是3.16)。

Despite the GRSEC issues (mount & chmod denied) I was able to run docker and create some image and container.

尽管存在GRSEC问题(mount & chmod deny),我仍然能够运行docker并创建一些映像和容器。

Then, I would reboot and docker would just spit out the error. I ran thin_check and what I found was this:

然后,我重新启动,docker会吐出错误。我进行了thin_check,我发现:

  • metadata was fine (I don't use a thin pool right now since docker keeps on telling me that my thin pool isn't a thin pool...)
  • 元数据很好(我现在不使用瘦池,因为docker一直告诉我瘦池不是瘦池…)
  • data was corrupted.
  • 数据被破坏。

Tried to repair it but thin_restore crashes.

试图修复它,但瘦了恢复崩溃。

I realized that: docker daemon ... was working but can't be stopped with systemctl stop docker.service. It says that the service is stopped but the daemon is still in memory (ps -elf | grep docker)

我意识到:docker守护进程……正在工作,但是不能用systemctl stop docker.service停止。它说服务已停止,但守护进程仍在内存中(ps -elf | grep docker)

To fix the problem I had to change the DOCKER_STORAGE_OPTIONS in /etc/default/docker

为了解决这个问题,我必须在/etc/default/docker中更改DOCKER_STORAGE_OPTIONS

rm -rf /var/lib/docker
reboot

At boot time, the service starts. docker info

在启动时,服务启动。码头工人信息

Shows the info as expected. Built an image. Rebooted, the service starts fine again. I think that basically the docker daemon can't be stopped and killing it with a:

按预期显示信息。建立一个图像。重启后,服务又恢复正常。我认为,docker守护进程不能被停止,并以一个:

kill <pid>

Causes the data file to be corrupted and therefore the checksum won't match.

导致数据文件被损坏,因此校验和不匹配。

Bottom line is don't mix and match docker.service and docker daemon. At least on Debian/Ubuntu.

底线是不要混搭docker。服务和码头工人守护进程。至少在Debian / Ubuntu。

#5


1  

In our case just need to start and stop the service.

在我们的情况下,只需要启动和停止服务。

#1


30  

The following is for a Fedora/RHEL system, so you'll need to adjust for Debian...

下面是Fedora/RHEL系统,因此您需要调整Debian…

# systemctl stop docker.service
# thin_check /var/lib/docker/devicemapper/devicemapper/metadata

If there were no errors then proceed with:

如果没有错误,则继续:

# thin_check --clear-needs-check-flag /var/lib/docker/devicemapper/devicemapper/metadata
# systemctl start docker.service
# docker run --name=fpm-5.3 debian:jessie

#2


5  

When the docker partition filled and docker would no longer start after reboot, I encountered this:

当docker分区被填满,并且在重新启动之后docker将不再启动时,我遇到了以下情况:

# thin_check /var/lib/docker/devicemapper/devicemapper/metadata
examining superblock
examining devices tree
  missing devices: [0, -]
    bad checksum in btree node
examining mapping tree
  thin device 72 is missing mappings [137494, 137594]
    bad checksum in btree node
  thin device 72 is missing mappings [137721, -]
    bad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree node

I was able to repair with this procedure:

我可以用这个程序进行修复:

# thin_dump -r /var/lib/docker/devicemapper/devicemapper/metadata -o /tmp/metadata.xml
# thin_restore -i /tmp/metadata.xml -o /var/lib/docker/devicemapper/devicemapper/metadata

#3


1  

I had the same problem and was not able to fix it. I found something promising at: http://grokbase.com/t/gg/docker-user/1563fzdtm7/docker-docker-runs-out-of-space-when-trying-to-create-a-new-image 'The default docker storage driver allocates 10GB storage blocks for your images. Move to overlayfs and avoid this entirely. In the command that starts your docker daemon just add "-s overlay" '

我遇到了同样的问题,无法解决。我在http://grokbase.com/t/gg/docker- user/1563fdoczdtm7 /docker- runos -out- when- tryto -create-a-new-image上发现了一些有希望的东西:默认的docker存储驱动程序为图像分配了10GB的存储块。移动到overlayfs,并完全避免这一点。在启动docker守护进程的命令中,只需添加“-s叠加”。

this fixed my problem.

这个固定我的问题。

#4


1  

I've been fighting this issue with Debian 8.2. I had other problems because I run a 4.3.3 Kernel (default is 3.16) with grsec.

我和Debian 8.2一直在争论这个问题。我还有其他问题,因为我使用grsec运行了4.3.3内核(默认值是3.16)。

Despite the GRSEC issues (mount & chmod denied) I was able to run docker and create some image and container.

尽管存在GRSEC问题(mount & chmod deny),我仍然能够运行docker并创建一些映像和容器。

Then, I would reboot and docker would just spit out the error. I ran thin_check and what I found was this:

然后,我重新启动,docker会吐出错误。我进行了thin_check,我发现:

  • metadata was fine (I don't use a thin pool right now since docker keeps on telling me that my thin pool isn't a thin pool...)
  • 元数据很好(我现在不使用瘦池,因为docker一直告诉我瘦池不是瘦池…)
  • data was corrupted.
  • 数据被破坏。

Tried to repair it but thin_restore crashes.

试图修复它,但瘦了恢复崩溃。

I realized that: docker daemon ... was working but can't be stopped with systemctl stop docker.service. It says that the service is stopped but the daemon is still in memory (ps -elf | grep docker)

我意识到:docker守护进程……正在工作,但是不能用systemctl stop docker.service停止。它说服务已停止,但守护进程仍在内存中(ps -elf | grep docker)

To fix the problem I had to change the DOCKER_STORAGE_OPTIONS in /etc/default/docker

为了解决这个问题,我必须在/etc/default/docker中更改DOCKER_STORAGE_OPTIONS

rm -rf /var/lib/docker
reboot

At boot time, the service starts. docker info

在启动时,服务启动。码头工人信息

Shows the info as expected. Built an image. Rebooted, the service starts fine again. I think that basically the docker daemon can't be stopped and killing it with a:

按预期显示信息。建立一个图像。重启后,服务又恢复正常。我认为,docker守护进程不能被停止,并以一个:

kill <pid>

Causes the data file to be corrupted and therefore the checksum won't match.

导致数据文件被损坏,因此校验和不匹配。

Bottom line is don't mix and match docker.service and docker daemon. At least on Debian/Ubuntu.

底线是不要混搭docker。服务和码头工人守护进程。至少在Debian / Ubuntu。

#5


1  

In our case just need to start and stop the service.

在我们的情况下,只需要启动和停止服务。