Question: I am trying to execute the container named **redis** which is running right now.But the error `Could not connect to Redis at redis:6379: Name or service not known`. Any one please hell me to figure out the issue and fix it.

Answer: 
Naming the container doesn't alter your hosts file or DNS, and depending on how you ran the container it may not be accessible via the standard port as Docker does port translation. 

Run `docker inspect redis` and examine the ports output, it will tell you what port it is accessible on as well as the IP. Note, however, that this will only be connectable over that IP from that host. To access it from off of the host you will need to use the port from the above command and the host's IP address. That assumes your local firewall rules allow it, which are beyond the scope of this site.
Try below command

```
src/redis-cli -h localhost -p 6379

```