How do I keep a summoned EnderDragon in a cage?

I did /Summon in minecraft and I summoned an ender dragon. My friend and I thought it would be cool if we built a cage for the ender dragon. We build a huge cage out of end stone, obsidian and bedrock. We summoned the ender dragon in the cage, and it could fly right out of the cage. mobGriefing was off, and we used blocks that the ender dragon couldn't destroy. Is there any way we can keep him from flying out of a cage? The cage was definitely big enough for at least 3 ender dragons.


With the new summon command 1.7.4, you can summon a enderdragon on a minecart. Then it will still look to you but it can't fly away. You can also give it custom names. :-) Here is the command.... you can make these commands with the new summon program

the command

the enderdragon


As FEichinger explained, it's impossible keep an Ender Dragon in place using building blocks.

But you can continuously teleport the Dragon to the same location using a Command Block with the /tp command (since snapshot 14w02a it can work on any entities, not just players).

Command block contents

Use a clock to repeatedly execute the command:

/tp @e[type=EnderDragon] X Y Z

And the Ender Dragon will be stuck in that location, but will shake quite a bit because it will try to move constantly...

Stuck dragon

Of course, you can add a cage around the Dragon as a cosmetic feature...