This poem comes from John Masefield's Salt Water Poems and Ballads, 1912. Masefield is also the author of A Sailor's Garland.

Charlie Ipcar adapted the poem to the melody of On the Range of the Buffalo. More details, including a melody sample, can be found on Charlie's website.