How to avoid images appear as post in google search?

This is because your attachment pages are being indexed by Google.

A simple fix would be to install the WordPress SEO plugin and use it to redirect the attachment page URLs to the original media (your images).

After you install the plugin, go to “Search Appearance”, then click the “Media” tab, and toggle the “Redirect attachment URLs to the attachment itself?” to “yes”.

You can read the full details in this Yoast Article or in this Knowledge Base Article.