Vy Do
Vy Do

Reputation: 52488

How to use redis-cli with Redis on Docker?

Run Redis in Docker

File docker-compose.yml

version: "3.8"

services:
  redis:
    image: redis
    volumes:
      - ./data:/data
    ports:
      - 6379:6379
docker pull redis
docker-compose up
docker-compose up -d
docker container ls
telnet localhost 6379

How to connect to Redis server with redis-cli ?

Upvotes: 0

Views: 4467

Answers (1)

n0nvme
n0nvme

Reputation: 1399

You can run attach to docker container and use redis-cli directly.

This command will attach you to the container's shell

docker exec -it CONTAINER_ID /bin/sh

Then you can use redis-cli just like it installed directly on the host system

Upvotes: 5

Related Questions