Home > other >  Unable to 127.0.0.1:6379 connected to Redis: connection refused in the docker
Unable to 127.0.0.1:6379 connected to Redis: connection refused in the docker

Time:09-23

I use a redis - server: the latest photos. I use "docker run - it - name=" redis2 "redis: 1 bash" command to enter inside the container. I see by default redis is listening on port: 6379.

Running stand in u.s mode

Port: 6379

PID: 39

http://redis.io

[39] Mar 01 09:03:45. 669 # Server started, Redis version 2.8.4 [39] Mar 01 09:03:45. 669 # WARNING overcommit_memory is set to 0. Background the save may fail under low memory condition.

To solve this problem, please add "vm. Overcommit_memory=1" to the/etc/sysctl. Conf, then reboot or run the command "sysctl vm. Overcommit_memory=1" to take effect. [39] Mar 01 09:03:45. 669 x server is now ready to accept connections on port 6379
Then further no response. I tried "redis - cli ping". No response. Then I click "CTRL c" and type "redis - the cli ping" and get the following response:

Could not connect to Redis at 127.0.0.1:6379: Connection refused

I try to change the port to 6001 by performing the following actions:

Redis - server - port 6003

I see the following reply:

Running stand in u.s mode

Port: 6003

PID: 47

I tried "redis - cli ping", it brought me the same error:

Could not connect to Redis at 127.0.0.1:6379: Connection refused

How do I solve? In addition, I have been in "/etc/redis/redis. Conf" position update the port (port 6003).
thank you

CodePudding user response:

Internal docker Redis is listening on port, on the network to access it from the local computer, you need to use the -p 6379:6379 to the local port the container port mapping. In this way, if you have multiple Redis container, can be respectively mapped to different ports on your computer.

CodePudding user response:

https://blog.csdn.net/baidu_36583119/article/details/105604906
  • Related