title: Deploy Django Channels with Docker
body: <p>I'm trying to deploy django channels with Docker and Django doesn't seem to find Redis (which I'm using as a channel layer).</p>
  
  <p>When I do it locally, I just run <code>redis-server</code> and point to it from settings:</p>
  
  <pre><code>CHANNEL_LAYERS = {
      'default': {
          'BACKEND': 'channels_redis.core.RedisChannelLayer',
          'CONFIG': {
              'hosts': [('localhost', 6379)],
          },
      },
  }
  </code></pre>
  
  <p>Everything works fine, web sockets are accepting connections and easily transfer my data. For production environment I use this docker config:</p>
  
  <pre><code>version: "3"
  
  services:
  
    backend:
      container_name: backend
      restart: 'on-failure'
      image: registry.testtesttest.com/app/backend:${BACKEND_VERSION:-latest}
      ports:
        - "8000:8000"
      environment:
        DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE:-settings.production}
        DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:-dev}
  
      redis:
          image: "redis:alpine"
          ports: 
             -"6379:6379"
  </code></pre>
  
  <p>And I point to redis from production settings:</p>
  
  <pre><code>CHANNEL_LAYERS = {
      'default': {
          'BACKEND': 'channels_redis.core.RedisChannelLayer',
          'CONFIG': {
              'hosts': [('redis', 6379)],
          },
      },
  }
  </code></pre>
  
  <p>And on production, Django says:</p>
  
  <blockquote>
    <p>Cannot find redis on 127.0.0.1:6379</p>
  </blockquote>
  
  <p>What am I doing wrong? Do I have to add any extra services do docker-compose file?</p>