A King is the head of state of a sovereign country, a Duke (usually) isn't. In a royal family, there can be only one king at any given time, but there can be several dukes - as well as princes - who may be related to him and likely in line for the throne.
A Queen can either be the consort of a king or a ruler in her own right (as in England and previously for several generations in the Netherlands). In the latter case, her husband is referred to as the prince-consort. This is the reason why Prince Philip is not the king of England, but is called the Duke of Edinburgh.
Duchies, areas nominally ruled by a duke, were not independent countries, but part of a kingdom or empire. Some smaller countries can be ruled by an Archduke (pre-WWI Austria), a Grand Duke (e.g. the Grand Duchy of Luxembourg) or a prince (e.g. the Principality of Monaco). In feudal times these were usually vassal states of larger kingdoms, which at some point in history obtained their independence.