Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What goes in "some-network" placeholder in dockerized redis cli?

Tags:

docker

redis

I'm looking at documentation here, and see the following line:

$ docker run -it --network some-network --rm redis redis-cli -h some-redis

What should go in the --network some-network field? My docker run command in the field before did default port mapping of docker run -d -p 6379:6379, etc.

I'm starting my redis server with default docker network configuration, and see this is in use:

$ docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
abcfa8a32de9        redis               "docker-entrypoint.s…"   19 minutes ago       Up 19 minutes       0.0.0.0:6379->6379/tcp   some-redis

However, using the default bridge network produces:

$ docker run -it --network bridge --rm redis redis-cli -h some-redis
Could not connect to Redis at some-redis:6379: Name or service not known
like image 709
Mittenchops Avatar asked Oct 20 '25 05:10

Mittenchops


1 Answers

Ignore the --network bridge command and use:

docker exec -it some-redis redis-cli
like image 163
Mittenchops Avatar answered Oct 22 '25 20:10

Mittenchops