I’d wager the difference between the current price of the slot and the value of the container is less than I’d be willing to pay for the container.
Alternatively, institute two simple rule: “No ship may leave the port with fewer containers than it entered with.” or even “no non-full ship may leave the port”.
If that leads to a shortage of movable empty containers (but the port is still full of immovable empty containers), add a second temporary rule: “any empty container stored at the port for more than N days may be ‘towed’ (by a cargo ship of the port’s choosing) to some other port.”