9

我已经docker 1.6.1从这个站点下载并安装了静态链接,然后运行它RHEL 7.1

[root@localhost bin]# ./docker -d
WARN[0000] Udev sync is not supported. This will lead to unexpected behavior, data loss and errors
INFO[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: devicemapper
INFO[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成功启用同步?

更新:检查反汇编代码后dm_udev_set_sync_support

(gdb) disassemble dm_udev_set_sync_support
Dump of assembler code for function dm_udev_set_sync_support:
=> 0x0000000000a3e4e0 <+0>:     repz retq
End of assembler dump.

它是一个空函数,什么都不做,更不用说设置同步支持。这是否意味着这个静态构建的 docker 二进制文件没有用?

4

2 回答 2

0

我无法重现您的问题;我得到以下信息:

(gdb) disassemble dm_udev_set_sync_support
Dump of assembler code for function dm_udev_set_sync_support@plt:
   0x0000000000403420 <+0>:     jmpq   *0xda8c92(%rip)        # 0x11ac0b8 <dm_udev_set_sync_support@got.plt>
   0x0000000000403426 <+6>:     pushq  $0x14
   0x000000000040342b <+11>:    jmpq   0x4032d0

帮自己一个忙:忽略 docker.io 所做的构建,直接从 RHEL 获取 Docker。它在附加频道中可用。虽然它通常会比上游版本晚几周(例如 1.6 而不是 1.7),但它也经过了良好的测试并保证可以实际工作。

于 2015-07-09T23:12:38.873 回答
0

在一些有用的反馈后修改我的原始答案:

您必须使用动态二进制文件:“问题当然是使用静态链接的二进制文件,udev 同步是不可能的,因此会导致损坏问题。这对于 RedHat(维护 devicemapper 驱动程序)来说很难查明,因为它们使用动态链接的二进制文件(他们在他们的仓库中提供)。

就在 1.7.0 发行版之后,docker 开始为 rpms 和 debs 提供来自主安装脚本 @get.docker.com 的动态链接二进制文件(以及 apt repos 以匹配)。这些二进制文件支持 udev 同步,并且 devicemapper 应该可以正常工作。”

幸运的是,自从 OP 创建以来,Docker 已更改其存储库以提供动态二进制文件。

参考:https ://github.com/docker/docker/issues/13179

于 2016-03-18T14:46:36.823 回答