You are completely right in focusing on the way in which this poem compares and contrasts the victory of the people with the death of their leader. This is the big contrast that drives the poem. However to focus on the quote you have selected, Whitman imagines a naval force returning to their home country, having been successful in battle and conquering their enemy. Thus it is that in the first stanza we have a description of the ship:
The port is near, the bells I hear, the people all exulting,
While follow eyes the steady keel, the vessel grim and daring;
Note how the scene is created: the ship is near port and the people are all celebrating and exulting. They are all watching the "steady keel" of the boat, that is described as "grim and daring" because of its exploits in warfare. Thus this description helps to support the idea of the victory celebration, as the people are recgonising how brave and daring the boat, and by implication, the soldiers have been in going out and fighting and coming back victorious. Note how immediately after this statement of victory the contrast is brought in with reference to the dead Captain.