Q:

Using Redis-CLI on Redis container

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 

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

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

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.

A:

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.

