First off, is that even cannabis in the pic you provided ? Sure doesn't look like it.

Anyways, the general rule of thumb is 1 gallon of container size for every 1 foot of vertical growth. So a 4 foot tall plant will be just fine in a 4 gallon container.