Trapping a bug

If someone is very frightened of a bug (that is not life threatening) can it be brought outside on shabbos. Can a cup or container be used to trap it?

It can not be trapped in any way where it is impossible for it to escape.