title: Redis connection refused when using traefik
body: <p>I'm having a hard time trying to configure one redis container for all my applications using traefik. This is my configuration:</p>
  
  <p>1 - Docker compose for Traefik and Redis:
      version: '2'</p>
  
  <pre><code>services:
    proxy:
      container_name: traefik
      image: traefik:1.3.6-alpine
      command: --docker
      ports:
        - 80:80
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - ./traefik.toml:/traefik.toml
      networks:
        - proxy
      labels:
        - traefik.frontend.rule=Host:monitor.company.dev
        - traefik.port=8080
  
  redis:
      container_name: main_redis
      image: redis:3.2
      restart: always
      volumes:
        - ./data/redis:/data
      networks:
        - proxy
      labels:
        - traefik.backend=main-redis
        - traefik.default.protocol=http
        - traefik.frontend.rule=Host:main-redis.company.dev
        - traefik.docker.network=proxy
        - traefik.port=6379
  
  networks:
    proxy:
      external: true
  </code></pre>
  
  <p>2 - Docker compose for my PHP Application.</p>
  
  <pre><code>version: '2'
  
  services:
    ...
  
  
    php:
      container_name: myapp_php
      build: ./docker/php # php:7.1-fpm base image
  
      networks:
        - internal
        - proxy
      labels:
        - traefik.enable=false
        - traefik.docker.network=proxy
      expose:
        - 9000
  
  networks:
    proxy:
      external: true
    internal:
      external: false
  </code></pre>
  
  <p>I tried to connect my php application to <code>main-redis.company.dev</code> on both ports <code>6379</code> and <code>80</code> but I get a <code>Redis::connect(): connect() failed: Connection refused</code> message.</p>
  
  <p>I also changed these stuff in my <code>redis.conf</code>:
  Commented the line with <code>bind 127.0.0.1</code>
  And changed <code>protected-mode</code> to <code>no</code></p>
  
  <p>My docker containers are staying in the same network, so I think it should work. Anyone knows why am I having this problem?</p>