If you have a nut allergy, you need to talk to your doctor about what foods to avoid. Even though coconut isn't a nut, some people who are allergic to tree nuts (like almonds, cashews, and walnuts) are also allergic to coconut. But others are not.
So talk to your doctor to see if coconut is OK for you. Until then, avoid coconut.
You already know that you have to watch out for foods (like candy and desserts) that could have tree nuts in them (or could have come in contact with tree nuts). Coconut also can be found in lots of foods, so you'll have to be just as careful in order to avoid it if your doctor says you shouldn't eat it.
And always make sure to wash your hands before eating and have your emergency epinephrine injector with you.