You may have been tempted to have the following line in the Dockerfile but it won't work because Docker Daemon manages container's /etc/hosts file.
echo "172.17.0.1 host.docker.internal" >> /etc/hosts
The solution is to use extra hosts parameter to the docker-compose.yml file.
Usually the extra hosts section is used to pass host-gateway's IP which is host's ip the container so the container can connect to the host.
Find out the Social networks we're on