Sure. Just like coaling stations and bunker fuel facilities didn't pop into existence with the snap of a finger either. Yet somehow they were built, eventually.
A grid can do it too, but spiky 400MW loads are difficult and annoying for a utility. And the port, who would probably have to call in to schedule charging.
It's much easier to "trickle" charge a grid scale battery bank, which can then be used however the port wants whenever they want without upsetting the grid.
Ports can have 10+ container ships at once and unloading one can take multiple days. You're not surprising the power company with sudden loads, you're building a big power plant at the docks and then selling power to the grid during the part of the day when the price is high and charging the ships when it's low.
In the end, all those battery powered ships needs to be charged. So it is their total energy consumption split between harbours over some period. And as we are talking about trickling you could pretty much average it.
It likely will depend on patterns of harbour. Like how many ships visit, what sort of distance those go. And how much of total time is spend charging some ship.
Worst case is maximum distance trips and maximum utilization that is there being ship almost always being docked. Apart from times when docked ship change.