RedisInsight is an intuitive and efficient GUI for Redis, allowing you to interact with your databases and manage your data—with built-in support for the most popular Redis modules. It runs on Windows, macOS, Linux and even can be run as a Docker container and Kubernetes Pods.
Last week, I came across the StackOverflow question around RedisInsight in Docker Compose and decided to come up with a blog post to talk detail around the solution.
Here’s a quick 5 minutes guide to help you get started with RedisInsight up and running using Compose file.
Step 1. Get Docker Desktop Ready
If you are on macOS, ensure that you install Docker Desktop on your system. Go to this link and choose “Download for Mac” for a quick installation.
Once you complete the installation, you should be able to verify by clicking “About Docker Desktop” on the whale icon.
You can verify it via CLI too:
docker version Client: Docker Engine - Community Cloud integration: 1.0.9 Version: 20.10.5 API version: 1.41 Go version: go1.13.15 Git commit: 55c4c88 Built: Tue Mar 2 20:13:00 2021 OS/Arch: darwin/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.5 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: 363e9a8 Built: Tue Mar 2 20:15:47 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.3 GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b runc: Version: 1.0.0-rc92 GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff docker-init: Version: 0.19.0 GitCommit: de40ad0 ajeetraina@Ajeets-MacBook-Pro community %
Step 2. Enable the File Sharing
Click “whale icon” appearing on the top bar, then select “Preference” under Docker Desktop > Select “Resources” > “File Sharing” and add the folder structure that you want to share. Please change the directory structure as per your environment
For this demonstration, I have add /data/redisinsight directory that I am planning to use in Docker Compose
Step 3. Create a Docker Compose file
We will be creating a compose file with 2 services – redis and redisinsight. Add the below content in Docker compose file and save it.
version: '3' services: redis: image: redislabs/redismod ports: - 6379:6379 redisinsight: image: redislabs/redisinsight:latest ports: - '8001:8001' volumes: - ./Users/ajeetraina/data/redisinsight:/db
Ensure that you don’t have any running Redis instance on port 6379. If it is running, ensure that you change the port in the compose file to some other values like 6380.
Step 4. Execute the Compose CLI
docker-compose up -d WARNING: The Docker Engine you're using is running in swarm mode. Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node. To deploy your application across the swarm, use `docker stack deploy`. Creating network "red_default" with the default driver Creating red_redisinsight_1 ... done Creating red_redis_1 ... done
Step 5. Verify if RedisInsight container is working or not
docker-compose ps Name Command State Ports ------------------------------------------------------------------------------------------ pinegraph_redis_1 redis-server --loadmodule ... Up 0.0.0.0:6379->6379/tcp pinegraph_redisinsight_1 bash ./docker-entry.sh pyt ... Up 0.0.0.0:8001->8001/tcp
Step 6. Accessing RedisInsight
Open HTTP://IP:8001 to access RedisInsight UI
If you try to use “localhost” and try to add Redis database, there are chances that you might face the below error message.
Instead, use your host IP address as shown below:
ifconfig en0 en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=400<CHANNEL_IO> ether 3c:22:fb:86:c1:b1 inet6 fe80::1cf6:84b:4aca:36ad%en0 prefixlen 64 secured scopeid 0x6 inet6 2401:4900:16e5:3dcc:184d:e209:e4ae:2ddc prefixlen 64 autoconf secured inet6 2401:4900:16e5:3dcc:5c08:6a0d:bff2:b87f prefixlen 64 autoconf temporary inet 192.168.43.81 netmask 0xffffff00 broadcast 192.168.43.255 nd6 options=201<PERFORMNUD,DAD> media: autoselect status: active
You should be able to connect to Redis database this time.