O Captain! my Captain! our faithful trip is done; (1)
The way in which the speaker feels emotionally connected to the captain and the mission is representative of how patriotism is the feeling of shared values and purposes. It's one big, warm, national fuzzy.
The port is near, the bells I hear, the people all exulting, (3)
The exultation of the people for the ship’s crew mirrors the patriotic feelings that the sailor feels toward them, and toward his captain. Everybody's feeling it.
Rise up—for you the flag is flung—for you the bugle trills; (10)
The flag is a patriotic symbol for the nation, but notice how the speaker says that the flag is “flung” or waved for the leader of the nation. The bugle is used in the military and implies that patriotism includes the willingness to fight for the common cause, under the leader's guidance.