def METHOD_NAME(name, entrypoint, cmd = None, caps_binary = None, caps = None, **kwargs):
    if not caps:
        # Fast path. If no caps are to be set, skip the setcap dance.
        container_image(
            name = name,
            cmd = cmd,
            entrypoint = entrypoint,
            visibility = ["//visibility:public"],
            **kwargs
        )
    else:
        container_image(
            name = name + "_nocap",
            cmd = cmd,
            entrypoint = entrypoint,
            **kwargs
        )
        setcap(
            name = name + "_withcap",
            image = name + "_nocap.tar",
            caps = caps,
            binary = caps_binary,
        )
        container_image(
            name = name,
            base = name + "_withcap.tar",
            cmd = cmd,
            entrypoint = entrypoint,
            visibility = ["//visibility:public"],
        )