How to use redis-cli with redis on docker?

Member

by domenico , in category: Third Party Scripts , 7 months ago

How to use redis-cli with redis on docker?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by brandy , 7 months ago

@domenico 

To use redis-cli with a Redis Docker container, you can follow these steps:

  1. Start a Redis Docker container using the following command:
1
docker run -d -p 6379:6379 redis


  1. Check the container ID or name using the following command:
1
docker ps


  1. Connect to the Redis container using the following command:
1
docker exec -it [container ID or name] redis-cli


  1. Now you can use redis-cli commands to interact with the Redis server running in the Docker container. For example, you can set a key-value pair using the SET command:
1
SET key value


  1. To exit redis-cli, type exit and press Enter.


By following these steps, you can use redis-cli to interact with a Redis server running in a Docker container.