This paper considers the combination of berth and crane allocation problems in container terminals. We propose a novel approach based on constraint programming which is able to model many realistic operational constraints. The costs for berth allocation, crane allocation, time windows, breaks and transition times during gang movements are optimized simultaneously. The model is based on a resource view where gangs are consumed by vessel activities. Side constraints are added independently around this core model. The model is richer than the state of the art in the operations research community. Experiments show that the model produces solutions with a cost gap of 1/10 (7,8%) to 1/5 (18,8%) compared to an ideal operational setting where operational constraints are ignored. © 2013 Springer-Verlag.