Docker/Redis
Appearance
< Docker
Try It
[edit | edit source]Online Free
[edit | edit source]- Use Play with Docker. Create an account and/or log in.
- Start an interactive session and add a new instance.
- In the terminal window, enter the following command:
docker run -d -p 6379:6379 --name=redis-server redis
- To connect to the redis-server, enter the following commands:
docker exec -it redis-server bashredis-cli
On Your Own System
[edit | edit source]- Install Docker Desktop or the Docker Engine.
- In a terminal window, enter the following command:
docker run -d -p 27017:27017 --name=redis-server redis
- To connect to the redis-server, enter the following commands:
docker exec -it redis-server bashredis-cli
Programming
[edit | edit source]- To connect to the redis-server from a programming language in a separate container:
- Use
redis-serverfor the host name. - Modify the
Dockerfileto install any required libraries.
- Use
- To connect to the redis-server from a programming language not running in a container:
- Use
localhostfor the host name. - Modify the
Dockerfileto install any required libraries.
- Use