docker-compose

Run Redis Insights in Docker Compose


I'm trying to run Redis Insight in Docker Compose and I always get errors even though the only thing I'm changing from the Docker Run command is the volume. How do I fix this?

docker-compose.yml

redisinsights:
  image: redislabs/redisinsight:latest
  restart: always
  ports:
    - '8001:8001'
  volumes:
    - ./data/redisinsight:/db

logs

redisinsights_1  | Process 9 died: No such process; trying to remove PID file. (/run/avahi-daemon//pid)
redisinsights_1  | Traceback (most recent call last):
redisinsights_1  |   File "./entry.py", line 11, in <module>
redisinsights_1  |   File "./startup.py", line 47, in <module>
redisinsights_1  |   File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
redisinsights_1  |     self._setup(name)
redisinsights_1  |   File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
redisinsights_1  |     self._wrapped = Settings(settings_module)
redisinsights_1  |   File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 157, in __init__
redisinsights_1  |     mod = importlib.import_module(self.SETTINGS_MODULE)
redisinsights_1  |   File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
redisinsights_1  |     return _bootstrap._gcd_import(name[level:], package, level)
redisinsights_1  |   File "./redisinsight/settings/__init__.py", line 365, in <module>
redisinsights_1  |   File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
redisinsights_1  |     mkdir(name, mode)
redisinsights_1  | PermissionError: [Errno 13] Permission denied: '/db/rsnaps'

Solution

  • Follow the below steps to make it work:

    Step 1. Create a Docker Compose file as shown below:

    version: '3'
    services:
      redis:
        image: redislabs/redismod
        ports:
          - 6379:6379
      redisinsight:
        image: redislabs/redisinsight:latest
        ports:
          - '8001:8001'
        volumes:
          - ./Users/ajeetraina/data/redisinsight:/db 
    

    Step 2. Provide sufficient permission

    Go to Preference under Docker Desktop > File Sharing and add your folder structure which you want to share.

    Please change the directory structure as per your environment

    Step 3. Execute the Docker compose CLI

    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
    

    Go to web browser and open RedisInsight URL. Enjoy!