Images are just the packaging and delivery item. You create and run a container based on an image.
I am not sure how telnet access is related to ping, but I assume you mean telnet can not reach the target host port.
Please share the content of the used compose file, and let us know whether you executed the telnet command on the host or inside a container.