Try It

edit

Online Free

edit
  1. Use Play with Docker. Create an account and/or log in.
  2. Start an interactive session and add a new instance.
  3. In the terminal window, enter the following command:
    • docker run -d -p 6379:6379 --name=redis-server redis
  4. To connect to the redis-server, enter the following commands:
    • docker exec -it redis-server bash
    • redis-cli

On Your Own System

edit
  1. Install Docker Desktop or the Docker Engine.
  2. In a terminal window, enter the following command:
    • docker run -d -p 27017:27017 --name=redis-server redis
  3. To connect to the redis-server, enter the following commands:
    • docker exec -it redis-server bash
    • redis-cli

Programming

edit
  1. To connect to the redis-server from a programming language in a separate container:
    • Use redis-server for the host name.
    • Modify the Dockerfile to install any required libraries.
  2. To connect to the redis-server from a programming language not running in a container:
    • Use localhost for the host name.
    • Modify the Dockerfile to install any required libraries.

See Also

edit