C.H.
The apple cider vinegar works, but you have to cover the container in saran wrap, stretch it tight with a rubberband, then with a toothpick, poke several holes in the top. After a day or two the gnats will go in because they like the smell of the fermenting vinegar (must be apple cider vinegar), but they can't get out. Eventually they give up and go for a swim. It may take a week, but once you start getting the younger ones, there will be no more egg laying. This worked for us when we brought home infested fruit.
Good luck.