4

Hello i am trying to issue commands to a Redis docker container. The container is up and running.I have used the following command: docker run -d -p 8300:85 -t redis

enter image description here

However when i try to use from my terminal: redis-cli -p 8300 nothing happens.
It just looks that it is waiting for something.

enter image description here

How can i communicate to my redis container; what am i doing wrong?

P.S After i have set the redis port to the defualt 6379 i get an id as response when using docker run but it still stops right there(first image):

enter image description here

From another terminal (second image) you can see that while the first terminal is blocked ,the instance is created but not started.

P.S 2 After waiting for like 10 minutes i finally get an error message when running the redis container:

$ docker run -d -p 8300:6379 -t redis
244d898dcfb0cd1da4828ee99a16bdd12f62499f99e8dc3ee17af9bacefe5b41
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: failed to create endpoint upbeat_blackwell on network nat: HNS failed with error : You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name.
0

1 Answer 1

8

It looks like you're publishing the wrong port with docker. Looking at your first screenshot you can see port 6379 (default redis) is not published to your host, but port 85 is published on port 8300.

Change your run command to docker run -d -p 8300:6379 -t redis and see if that helps.

As an alternative you can execute redis-cli from your running container docker exec -it a425 redis-cli (a425 is your container ID from the first screenshot). In this case you don't need anything installed on your host machine.

Sign up to request clarification or add additional context in comments.

8 Comments

But i wanted it to be set at port 85 inside the container.Why would it set it to 6379 ?
Ok now after i have set the port to 6379 i get an id as a response but it still stops there after that.From another terminal i can see that the instance STATUS is CREATED but it isn't running.I have updated my post .
That sounds like another question/problem to me. Why are you adding the -t redis in the end? Did you follow some guide?
I see no mention of -t redis on the redis docker image documentation so try without that, but since it started without it the first time I doubt that's the issue. You could try to delete the redis container, restart your docker daemon and try again if it's just a test environment.
I think this explains your second problem.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.