Ping is not installed on docker images by default as they are have minimal functionalities, you will have to install it for it to work:
apt-get install iputils-ping
You can add the ping command to you dockerfile while you are creating your image so you don't have to install it everytime you want to use ping on your containers. Just write these instructions in your dockerfile:
RUN apt-get update && apt-get install -y iputils-ping
Learn more on how to work with docker containers and docker images through docker training course where you will be taught by industry professionals.