<p>i want to expose the container ip to the external network where the host is running so that i can directly ping the docker container ip from an external machine.
If i ping the docker container ip from the external machine where the machine hosting the docker and the machine from which i am pinging are in the same network i need to get the response from these machines</p>

<p>Pinging the container's IP (i.e. the IP it shows when you look at <code>docker inspect [CONTAINER]</code>) from another machine does not work. However, the container is reachable via the public IP of its host.</p>

<p>In addition to Borja's answer, you can expose the ports of Docker containers by adding <code>-p [HOST_PORT]:[CONTAINER_PORT]</code> to your <code>docker run</code> command.</p>

<p>E.g. if you want to reach a web server in a Docker container from another machine, you can start it with <code>docker run -d -p 80:80 httpd:alpine</code>. The container's port <code>80</code> is then reachable via the host's port <code>80</code>. Other machines on the same network will then also be able to reach the webserver in this container (depending on Firewall settings etc. of course...)</p>
