Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
The gate dates back to around 1126 CE when the AlmoravidemirAli ibn Yusuf built the first walls of the city. Doukkala, was that of both a Berber tribe and of a region between Marrakesh and Casablanca today. Unlike many other gates of the city, it has not been subject to major modifications (at least in its floor plan) and retains its original sophisticated bent entrance design from the Almoravid period. The passage inside the gate bends at a straight angle twice: one enters from the west, turns south, then turns east before emerging into the city. Today the gate is flanked by other simple openings in the wall to allow for easy circulation. The city's main intercity bus terminal is also located just outside and slightly north of Bab Doukkala gate.
Floor plan of Bab Doukkala (the light grey shaded areas indicate roofed areas inside the gate)