Docker

Install docker:

https://store.docker.com/search?type=edition&offering=community

Run Server

docker run --name redis -v /tmp/redis:/data -d redis redis-server --appendonly yes
  • –name {name}: where {name} is the nick name of the container
  • -v {path}:/data: where {path} will be used by redis to persist data

Run Client

docker run -it --link redis:redis --rm redis redis-cli -h redis -p 6379

Or… go all in, and use docker-compose for convenience

Create a ‘docker-compose.yml’ file in an empty folder:

version: '3'

services:
  redis:
    container_name: redis
    image: redis
    ports:
     - "6379:6379"
    volumes:
     - "./data/redis:/data"
  redis-commander:
    container_name: redis-commander
    hostname: redis-commander
    image: rediscommander/redis-commander:latest
    restart: always
    environment:
    - REDIS_HOSTS=local:redis:6379
    ports:
    - 8081:8081

On the terminal, navigate to the folder and run:

docker pull rediscommander/redis-commander:latest

then start:

docker-compose up

You will get a web ui, redis-commander, on http://localhost:8081

References:

Categories: TL;DR

0 Comments

Leave a Reply

Avatar placeholder