I use MacOS Mojave. Below is the issue of diskutil
There is 150G of free space. After you have executed the resize command. I see error 69519.
How do I merge the free space with disc0s2?
MacBook Pro: ~ mac $ sudo diskutil apfs resizeContainer disk0s2 0
APFS process started
Defect: -69519: The target volume is too small for this operation, or there is a missing or too small gap in your partition mapping. This is often caused by an attempt to enlarge a partition beyond the beginning of another partition, or beyond the end of the usable space of the partition
I've done the following steps (disk0s4 does not appear deleted in the image and now has free space)
Step 1: Delete the container
sudo diskutil apfs deleteContainer disk0s4
Step 2: Delete the volume
sudo diskutil eraseVolume "Free Space"% noformat% / dev / disk0s4
Step 3: Change the size of the container
sudo diskutil apfs resizeContainer disk0s2 0