Jacob explains.

In 1867, Jacob tried to explain the nature of the Island to Ricardo. He used a bottle of wine as a metaphor to help him understand. He explained that the wine represented evil, and that it needed to be contained by the bottle, because otherwise "it would spread." He explained that the cork represented the Island, holding the darkness where it belonged. ("Ab Aeterno") Later Jacob gave the wine bottle to the Man in Black, saying it would help to pass the time. After Jacob left, the man in black raised the bottle of wine and turned it upside down. He then smashed the bottle against the log he was sitting on, splashing wine everywhere. ("Ab Aeterno")

Jacob's mother offers him a glass of wine from a similar bottle at the end of the ritual.

A similar wine bottle was used more than a millennium earlier in the ritual in which Jacob's adoptive mother conferred the guardianship of the Source onto Jacob. Drinking from the bottle supposedly represented the acceptance of responsibility for the Source's protection. ("What They Died For")

The concept of bottle and cork was an analogy for for the large stone in the cave at the Heart of the Island which actually functioned as a cork, stopping the flow of light. ("The End")

The Man in Black has his own solution.

Relationship to the Swan

"Access Granted" on Lost: The Complete Third Season (DVD) similarly described the Swan as a sort of "cork" that plugged the Incident's electromagnetic leak. In one of Locke's flashbacks during "Orientation", an episode whose present storyline involved debate as to the Swan's nature, Helen, alluding to her temper, says, "I have to keep a cork in it. Once I get all hot and bothered there's no stopping me."