Container terminals offer transfer facilities to move containers from vessels to trucks, trains and barges and vice versa. Incoming containers are not immediately loaded on an outgoing vehicle, but stored in the yard for up to several days. The yard is divided into blocks with several bays consisting of stacks and tiers. Figure 1 illustrates these terms. Terminals stack containers to use their scare land efficiently. Only the topmost container of each stack can be accessed directly. If another container has to be retrieved, containers above have to be relocated. These unproductive moves cannot be avoided completely as little information about future retrievals is known when a container is stored. But, poor yard management increases the number of relocations and the time needed to retrieve containers. Thereby, it decreases the overall productivity of the terminal. The container (or block) relocation problem consists in minimizing the number of relocations during the retrieval process. The container relocation problem is shown to be NP-hard. We present a branch and price procedure to solve the problem exactly