title: How to set an Haproxy on a docker container to manage the connections to the redis
body: <p>I have two docker containers, one for redis and the other for Haproxy. the redis image works well i can read and write normally at the standard socket 127.0.0.1:3000. to do that, i bash inside the redis container and apply the redis-cli.
  my question is, how can I read or write using haproxy?
  is there any way to change the IP adresses of docker containers?</p>
  <p>the running images:</p>
  <pre><code>docker run --name my-redis -p 3000:6379 -d redis
  </code></pre>
  <pre><code>docker run -d --name my-running-haproxy --sysctl net.ipv4.ip_unprivileged_port_start=0 my-haproxy
  </code></pre>
  <p>the haproxy config file is as follow:</p>
  <pre><code>defaults REDIS 
  mode tcp  
  timeout connect 3s  
  timeout server 3s  
  timeout client 3s 
   
  frontend ft_redis 
  mode tcp 
  bind *:8080 
  default_backend bk_redis
    
  backend bk_redis 
      mode tcp 
      server redis1 127.0.0.1:3000 check fall 3 rise 2
      option tcp-check 
      tcp-check send AUTH\ \r\n 
      tcp-check expect string +OK 
      tcp-check send PING\r\n 
      tcp-check expect string +PONG 
      tcp-check send info\ replication\r\n 
      tcp-check expect string role:master 
      tcp-check send QUIT\r\n 
      tcp-check expect string +OK 
  </code></pre>