Source: Dungeon Master's Guide

Wondrous item, legendary

This iron bottle has a brass stopper. You can use an action to speak the flask's command word, targeting a creature that you can see within 60 feet of you. If the target is native to a plane of existence other than the one you're on, the target must succeed on a DC 17 Wisdom saving throw or be trapped in the flask. If the target has been trapped by the flask before, it has advantage on the saving throw. Once trapped, a creature remains in the flask until released. The flask can hold only one creature at a time. A creature trapped in the flask doesn't need to breathe, eat, or drink and doesn't age.

You can use an action to remove the flask's stopper and release the creature the flask contains. The creature is friendly to you and your companions for 1 hour and obeys your commands for that duration. If you give no commands or give it a command that is likely to result in its death, it defends itself but otherwise takes no actions. At the end of the duration, the creature acts in accordance with its normal disposition and alignment.

An Identify spell reveals that a creature is inside the flask, but the only way to determine the type of creature is to open the flask. A newly discovered bottle might already contain a creature chosen by the DM or determined randomly.

d100 Contents
01-50 Empty
51 Arcanaloth
52 Cambion
53-54 Dao
55-57 Demon (type 1)
58-60 Demon (type 2)
61-62 Demon (type 3)
63-64 Demon (type 4)
65 Demon (type 5)
66 Demon (type 6)
67 Deva
68-69 Devil (greater)
70-72 Devil (lesser)
73-74 Djinni
75-76 Efreeti
77-78 Elemental (any)
79 Githyanki knight
80 Githzerai zerith
81-82 Invisible stalker
83-84 Marid
85-86 Mezzoloth
87-88 Night hag
89-90 Nycaloth
91 Planetar
92-93 Salamander
94-95 Slaad (any)
96 Solar
97-98 Succubus/incubus
99 Ultroloth
00 Xorn