Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong bind 127.0.0.1 for docker image #1851

Closed
1 of 2 tasks
rnz opened this issue Oct 23, 2023 · 2 comments
Closed
1 of 2 tasks

Wrong bind 127.0.0.1 for docker image #1851

rnz opened this issue Oct 23, 2023 · 2 comments
Labels
bug type bug

Comments

@rnz
Copy link

rnz commented Oct 23, 2023

Search before asking

  • I had searched in the issues and found no similar issues.

Version

Bind to 127.0.0.1 in the configuration is not suitable for the docker image

Minimal reproduce step

$ docker run -d -p 6666:6666 apache/kvrocks:latest
67a4d65e172a67ce9d3c32a159fbdd1c9fd137294f9ca91a97a5728965558631

$ docker ps
CONTAINER ID  IMAGE                            COMMAND               CREATED         STATUS         PORTS                     NAMES
67a4d65e172a  docker.io/apache/kvrocks:latest                        4 minutes ago   Up 4 minutes   0.0.0.0:6666->6666/tcp  focused_grothendieck

$ docker exec -it 67 sh 
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
/ # netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks
tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      1/kvrocks

/ # exit
$ redis-cli -p 6666 info | wc -l
Error: Connection reset by peer

What did you expect to see?

Connecting by redis-cli to kvrocks instance which was run in docker, such for example as it make with redis images:

$ docker ps
CONTAINER ID  IMAGE                            COMMAND               CREATED         STATUS         PORTS                     NAMES
55a62aa0c896  docker.io/library/redis:latest   redis-server          29 minutes ago  Up 29 minutes  0.0.0.0:6379->6379/tcp    gifted_kare
$ redis-cli -p 6379 info | wc -l
214

What did you see instead?

Error: Connection reset by peer

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@rnz rnz added the bug type bug label Oct 23, 2023
rnz referenced this issue Oct 23, 2023
By default, it is more secure and common to bind to localhost instead of `0.0.0.0`.

Co-authored-by: Binbin <[email protected]>
@PragmaTwice
Copy link
Member

PragmaTwice commented Oct 23, 2023

Hi @rnz, thanks for your report.

We have fixed it in #1784, although there is currently no release including this commit.

To workaround it in 2.6.0, you can overwrite the configuration option like:

docker run -it -p 6666:6666 apache/kvrocks:2.6.0 --bind 0.0.0.0

@PragmaTwice
Copy link
Member

I will close this issue since it is fixed.

Feel free to open it again if you have further problem about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type bug
Projects
None yet
Development

No branches or pull requests

2 participants