This fix is a follow up to the comment: https://github.com/docker/docker/pull/28717#discussion_r90040589 Currently, the collision checking is done at the last step `Add()` of plugin creation. However, at this stage the context such as plugin directories have already been creation. In case of name collision, rollback is needed which could be expensive. This fix performs the check at the beginning of CreateFromContext using GetByName. In this way, collision fails fast and no context creation or rollback is needed. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> Upstream-commit: 52405a9b5896fd1c3ea6d8b1ca1c70e5979e3271 Component: engine