gpt4 book ai didi

docker - 为什么我无法连接到 Redis Docker 组件的端口?

转载 作者:行者123 更新时间:2023-12-02 18:17:51 25 4
gpt4 key购买 nike

我已经运行了命令

docker run -p 6379:6379 --name some-redis -d redis

当我在浏览器中运行 localhost:6376 时,我收到错误消息 ERR_INVALID_HTTP_RESPONSEResdis 正在运行:

    Steins-MacBook-Air:Domain steinkorsveien$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
474e7611824d redis "docker-entrypoint.s…" 17 hours ago Up 17 hours 0.0.0.0:6379->6379/tcp some-redis

如何连接到 Redis 组件?

最佳答案

您无法从浏览器连接到 Redis,您可以从命令行验证连接和 Redis 健康状况。

docker exec -it some-redis sh -c "redis-cli"

enter image description here

由于 Redis 在 TCP 级别接受连接,因此浏览器只能在 HTTP 级别工作。

网络层

A client connects to a Redis server creating a TCP connection to the port 6379.While RESP is technically non-TCP specific, in the context of Redis the protocol is only used with TCP connections (or equivalent stream oriented connections like Unix sockets).

关于docker - 为什么我无法连接到 Redis Docker 组件的端口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62672325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com