Could not connect to Redis at 127.0.0.1:6379: Connection refused in Docker container

Dung Do Tien Feb 07 2021 19

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!

Have 1 answer(s) found.
  • 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-server
    
    Do Chuong Feb 07 2021
Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close