Could not connect to Redis at 127.0.0.1:6379: Connection refused in Docker container
I'm studying Docker, I just installed Redis inside Docker container, everything installs success but when I type
redis-cli comand to access Redis local IP 127.0.0.1 port 6379 so I got an error: Could not connect to Redis at 127.0.0.1:6379: Connection refused
Could not connect to Redis at 127.0.0.1:6379: Connection refuse not connected>
Note that Redis is installed inside of Docker container. If install in Ubuntu OS It's still working fine for me.
Thanks for any suggestion!
This error occurs when Redis is disabled. To start Redis server you can run the command below:
1. Redis install inside of Docker container
sudo service redis-server start
To restart Redis inside Docker run command:
sudo service redis-server restart
2. Redis install outside of Docker(In OS such as Ubuntu)
systemctl restart redis-server systemctl enable redis-server
To check the status of Redis run command:
systemctl status redis-serverDo Chuong Feb 07 2021