many
others
遇到此问题(或跳到下面的解决方案):
这里的一般问题是早期版本的Docker可能
devicemapper
将信号量/cookie泄漏到容器的装载空间之外。对我来说,这是在多次快速给docker打电话之后发生的
build
,
run
,
rm
stop
等
这可能会导致系统的信号量数组在未清除的情况下填满,这将阻止所有docker命令工作(并可能影响依赖于这些共享信号量的其他系统功能)。
你可以通过
increasing the number of semaphore arrays
,或者像下面这样清除一些旧数组。
公认答案使用
clearing all semaphores
dmsetup udevcomplete_all
,但如果有其他容器或进程依赖于这些cookie/信号量,则可能不希望这样做。
semaphore arrays
--这些在我的机器上已满(128个阵列):
$ ipcs -u
------ Semaphore Status --------
used arrays = 128
allocated semaphores = 1136
------ Messages Status --------
allocated queues = 0
used headers = 0
used space = 0 bytes
------ Shared Memory Status --------
segments allocated 2
pages allocated 20057
pages resident 16214
pages swapped 2
Swap performance: 0 attempts 0 successes
这些信号量对应于dm cookies,如所示
ipcs
和
dmsetup udevcookies
(仅显示最近的Cookie;查找匹配项)
semid
$ ipcs -s -t
semid owner last-op last-changed
540278908 root Sat Jun 13 10:03:57 2020 Sat Jun 13 10:03:57 2020
548634749 root Sat Jun 13 10:09:22 2020 Sat Jun 13 10:09:22 2020
555876478 root Sat Jun 13 10:14:05 2020 Sat Jun 13 10:14:05 2020
572096639 root Sat Jun 13 11:43:42 2020 Sat Jun 13 11:43:42 2020
...
$ dmsetup udevcookies
Cookie Semid Value Last semop time Last change time
0xd4d819c 540278908 1 Sat Jun 13 10:03:57 2020 Sat Jun 13 10:03:57 2020
0xd4d8d60 548634749 1 Sat Jun 13 10:09:22 2020 Sat Jun 13 10:09:22 2020
0xd4d8eca 555876478 1 Sat Jun 13 10:14:05 2020 Sat Jun 13 10:14:05 2020
0xd4d7263 572096639 1 Sat Jun 13 11:43:42 2020 Sat Jun 13 11:43:42 2020
...
为了避免影响旧的信号量/cookie,我想使用
msetup udevreleasecookie <cookie ID>
:
# filter the list of cookies, get the IDs, and feed it to udevreleasecookie:
$ REGEX_STR="Jun 13" # change to whatever filter you need
$ dmsetup udevcookies | grep -E "$REGEX_STR" | awk '{ print $1 }' | xargs -n1 dmsetup udevreleasecookie
# check that the semaphores are gone
$ ipcs -s -t | grep -E "root" | grep -E "$REGEX_STR"
...
$
这让我可以跑步
docker