Assigning an Ender Dragon a scoreboard team doesn't make her stop attacking her teammates, plus she still damages them.
Summon an Ender Dragon (/summon EnderDragon)
Create a new scoreboard team (/scoreboard teams add 1 1)
Make everyone join the said team (/scoreboard teams join 1 @e)
Turn friendly fire off (/scoreboard teams option default friendlyfire false)
The Ender Dragon still attacks/knocks back you and other mobs that are on the same team.
Additionally, mobs with a knockback resistance of 100% still get knocked back by the Ender Dragon.
Again WAI. MC-46956