为了账号安全,请及时绑定邮箱和手机立即绑定

如何在 docker 中成功启用 udev 同步?

如何在 docker 中成功启用 udev 同步?

Go
弑天下 2021-10-04 17:28:20
我已经docker 1.6.1从该站点下载并安装了静态链接,并在以下位置运行它RHEL 7.1:[root@localhost bin]# ./docker -dWARN[0000] Udev sync is not supported. This will lead to unexpected behavior, data loss and errorsINFO[0000] +job init_networkdriver()INFO[0000] +job serveapi(unix:///var/run/docker.sock)INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)INFO[0000] -job init_networkdriver() = OK (0)INFO[0000] Loading containers: start.INFO[0000] Loading containers: done.INFO[0000] docker daemon: 1.6.1 97cd073; execdriver: native-0.2; graphdriver: devicemapperINFO[0000] +job acceptconnections()INFO[0000] -job acceptconnections() = OK (0)INFO[0000] Daemon has completed initialization我可以看到有一个警告:“ Udev sync is not supported. This will lead to unexpected behavior, data loss and errors”,检查docker源代码后,我发现警告日志来自deviceset.go:func (devices *DeviceSet) initDevmapper(doInit bool) error {    ......    // https://github.com/docker/docker/issues/4036    if supported := devicemapper.UdevSetSyncSupport(true); !supported {        log.Warnf("Udev sync is not supported. This will lead to unexpected behavior, data loss and errors")    }    log.Debugf("devicemapper: udev sync support: %v", devicemapper.UdevSyncSupported())    ......}该devicemapper.UdevSetSyncSupport是这样的:// UdevSyncSupported returns whether device-mapper is able to sync with udev//// This is essential otherwise race conditions can arise where both udev and// device-mapper attempt to create and destroy devices.func UdevSyncSupported() bool {    return DmUdevGetSyncSupport() != 0}// UdevSetSyncSupport allows setting whether the udev sync should be enabled.// The return bool indicates the state of whether the sync is enabled.func UdevSetSyncSupport(enable bool) bool {    if enable {        DmUdevSetSyncSupport(1)    } else {        DmUdevSetSyncSupport(0)    }    return UdevSyncSupported()}我可以看到原因是启用udev同步失败。如何udev成功启用同步?
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 311 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信