Cochrane, a younger son of the 8th Earl of Dundonald, joined the Navy as a boy. He first served in the West Indies and was wounded in action off Martinique in 1780. During the Napoleonic Wars he commanded a succession of vessels. In 1806 he was made a Knight of Bath in recognition of his services and, in 1810, after the capture of the island of Guadaloupe, he was appointed its governor with the rank of Vice-Admiral. He was promoted to the rank of Admiral in 1810 and was appointed to the post of Commander-in-Chief, Plymouth (a senior commander of the Royal Navy) in 1821.