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.
Most webmasters and web hosts that use Redis would have seen this error: Could not connect to Redis at 127.0.0.1:6379: Connection refused It is usually caused when the Redis service is stopped in the server. As part of our Server Management Services for online service providers and website owners, we have seen several other causes for this error.
There can be different reasons of raising the error. I am trying to provide the reason and the solution to overcome from that situation. Make sure you have installed redis-server properly. 6379 Port is not allowed by ufw firewall. The issue can be related to permission of redis user.
By default Redis server listen to the TCP port 6379. If another application is using the port or if the firewall restrictions blocks the port, it can trigger the connection refused error.
Typically, above error occurs when Redis is disable. systemctl restart redis-server systemctl enable redis-server 2. You may need to daemonize the redis-server so that docker can connect to it: Then try again the command you performed, that gives you error.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With