question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

redis ConnectionError on docker

See original GitHub issue

Issue Summary

Status: Downloaded newer image for redash/redash:4.0.0-rc.1.b3785
[2018-03-05 01:35:21,730][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2018-03-05 01:35:21,760][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
Traceback (most recent call last):
  File "/app/manage.py", line 6, in <module>
    from redash.cli import manager
  File "/app/redash/__init__.py", line 76, in <module>
    reset_new_version_status()
  File "/app/redash/version_check.py", line 34, in reset_new_version_status
    latest_version = get_latest_version()
  File "/app/ redash/version_check.py", line 40, in get_latest_version
    return redis_connection.get(REDIS_KEY)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 880, in get
    return self.execute_command('GET', name)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 578, in execute_command
    connection.send_command(*args)
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 563, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 538, in send_packed_command
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 442, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 99 connecting to localhost:6379. Cannot assign requested address.

A summary of the issue and the browser/OS environment in which it occurs.

Steps to Reproduce

docker-compose.yml

version: '2'

services:
  server:
    image: redash/redash:4.0.0-rc.1.b3785
    depends_on:
      - postgres
      - redis
    ports:
      - "45000:5000"
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: "INFO"
      REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
      REDASH_COOKIE_SECRET: veryverysecret
      REDASH_WEB_WORKERS: 4
    command: server
    restart: always

  worker:
    image: redash/redash:4.0.0-rc.1.b3785
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: "INFO"
      REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
      QUEUES: "queries,scheduled_queries,celery"
      WORKERS_COUNT: 2
    command: scheduler
    restart: always

  redis:
    image: redis:3.0-alpine
    restart: always

  postgres:
    image: postgres:9.5.6-alpine
    volumes:
      - postgres-data:/var/lib/postgresql/data
    restart: always

  nginx:
    image: redash/nginx:latest
    ports:
      - "45080:80"
    depends_on:
      - server
    links:
      - server:redash
    restart: always

volumes:
  postgres-data: {}
$ docker-compose run --rm server create_db

Technical details:

  • Redash Version: 4.0.0-rc.1.b3785
  • Browser/OS: ubuntu16.04
  • How did you install Redash: dockerhub

I suppose REDASH_REDIS_URL or REDIS_URL has problems

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
arikfrcommented, Apr 6, 2018

I copy pasted your docker-compose.yml file (with a single change: using the 4.0.0-rc.1 image) and everything works just fine.

$ docker-compose run --rm server create_db
Starting bug_redis_1 ... done
Starting bug_postgres_1 ... done
Pulling server (redash/redash:4.0.0-rc.1)...
4.0.0-rc.1: Pulling from redash/redash
23a6960fe4a9: Pull complete
e9e104b0e69d: Pull complete
cd33d2ea7970: Pull complete
534ff7b7d120: Pull complete
7d352ac0c7f5: Pull complete
c3c5a6207a0b: Pull complete
554d68c17a7f: Pull complete
17eadc3a433b: Pull complete
20010883713d: Pull complete
acda5fc98580: Pull complete
170712b9c850: Pull complete
76e333513ce6: Pull complete
8ed9077144f6: Pull complete
fa282dcf0141: Pull complete
Digest: sha256:962c7a6c103891716d864d2af39f936b415eb3ccae5e04b90861ad97bfaee5f6
Status: Downloaded newer image for redash/redash:4.0.0-rc.1
[2018-04-06 21:00:41,882][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2018-04-06 21:00:41,910][PID:1][INFO][root] Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
[2018-04-06 21:00:44,091][PID:1][INFO][alembic.runtime.migration] Context impl PostgresqlImpl.
[2018-04-06 21:00:44,091][PID:1][INFO][alembic.runtime.migration] Will assume transactional DDL.
[2018-04-06 21:00:44,106][PID:1][INFO][alembic.runtime.migration] Running stamp_revision  -> 969126bd800f

Not sure what went wrong in your case, but it looks like a local setup issue. 🤷‍♂️

Feel free to reopen if you have more details.

3reactions
GoingMyWaycommented, Mar 29, 2021

Please install redis-server by sudo apt-get install redis-server. And run redis-sever in background.

For me, this problem is solved by installing and running redis-server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis Docker connection refused - Stack Overflow
If you're running boot2docker (or in any other VM) you need to use the IP of the VM not localhost. If you're using...
Read more >
Docker could not connect to redis at 127.0.0.1:6379 - Bobcares
Wondering how to resolve Docker could not connect to redis at 127.0.0.1:6379: connection refused error? We can help you.
Read more >
Fails to connect to redis, when running inside of docker ...
My application is a microservice, which connects to a redis database, which is running inside of docker. However, I can not connect to...
Read more >
I cannot connect to Redis image from a Node image within ...
I cannot connect to Redis image from a Node image within Docker ... is from my client which is ioredis but it is...
Read more >
Redis connection refused, using Docker : r/django - Reddit
py", line 557, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 111 connecting to 0.0.0.0:6379.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found