Why do I not get connection to port of the Redis Docker component?

Viewed 856

I have run the command

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

When I run localhost:6376 in the browse I get the error message ERR_INVALID_HTTP_RESPONSE The Resdis is running:

    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

How do I get connected to the Redis component?

2 Answers

You can not connect to Redis from the browser, you can verify the connection and Redis health from the command line.

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

enter image description here

As Redis accept connection at the TCP level, so browser only work with HTTP level.

Networking layer

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).

Redis server listens on a tcp connection not a http one, so it wouldn't be accessible via the browser. You could use redis-cli to communicate with the redis server, or if you prefer a GUI I'd recommend redis-commander

Related