You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 17.04下Django Channels集成Redis遇连接错误求助

Fixing Django Channels Redis Connection Error on Ubuntu 17.04

Let's tackle your problem from two angles: first, getting Redis running without Docker (since that's your immediate need), and then fixing the Docker installation if you still want to use that approach later.

Option 1: Install Redis Directly (No Docker Needed)

This is the simplest way to get Redis up and running for Django Channels on Ubuntu 17.04:

  1. Update your package list

    sudo apt-get update
    
  2. Install the Redis server package

    sudo apt-get install redis-server
    
  3. Verify Redis is running
    By default, Redis starts automatically after installation and listens on port 6379 (exactly what Channels requires). Test the connection with:

    redis-cli ping
    

    You should get a PONG response if everything's working.

  4. Manage the Redis service

    • Check status: sudo systemctl status redis-server
    • Start if it's not running: sudo systemctl start redis-server
    • Set it to start on boot: sudo systemctl enable redis-server
  5. Confirm Channels Configuration
    Make sure your settings.py has the correct Redis channel layer setup:

    CHANNEL_LAYERS = {
        "default": {
            "BACKEND": "channels_redis.core.RedisChannelLayer",
            "CONFIG": {
                "hosts": [("127.0.0.1", 6379)],
            },
        },
    }
    

Once Redis is running, the [Errno 111] Connect call failed error should disappear, since Django Channels can now reach the Redis server on port 6379.

Option 2: Fix Docker Installation on Ubuntu 17.04

If you still want to use Docker for Redis, the issue is that you installed the old/unofficial Docker package from Ubuntu's default repos. Here's how to install the official Docker CE:

  1. Uninstall existing Docker packages

    sudo apt-get remove docker docker-engine docker.io containerd runc
    
  2. Install required dependencies

    sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
    
  3. Add Docker's official GPG key

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  4. Add Docker's official repository
    Ubuntu 17.04 uses the codename zesty, so run:

    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
    
  5. Update package list and install Docker CE

    sudo apt-get update
    sudo apt-get install docker-ce
    
  6. Test Docker works

    sudo docker run hello-world
    

    If you see a welcome message, Docker is installed correctly. Now you can run the Redis command from the tutorial:

    sudo docker run -p 6379:6379 -d redis:2.8
    

内容的提问来源于stack exchange,提问作者Elgin Cahangirov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:21:27