Yes, a coconut is a true fruit.
True fruits are defined as those that develop from the ovary of a flower after fertilization. The pericarp, which is the outer edible layer (though not always edible in its entirety), is a characteristic of true fruits. Coconuts fit this description perfectly. They develop from the ovary of the coconut palm flower, and they contain a seed (the kernel inside).
Therefore, based on the botanical definition, a coconut is classified as a true fruit, also known as a eucarp.