OH yes, it is and many people do. Use larger containers, at least 5 gallon bucket size or larger. Tomatoes do need sun.
I have grown all sorts of veggies in containers including peas and beans, cucumbers, tomatoes, melons, peppers, squash, eggplants, baby okra and of course herbs.