title: RedisInsight on Docker and Redis on Docker: Could not connect: Error 99 connecting to localhost:6379. Cannot assign requested address
body: <p>Based on this tutorial <a href="https://www.youtube.com/watch?v=XrFeRwJjWHI" rel="nofollow noreferrer">https://www.youtube.com/watch?v=XrFeRwJjWHI</a> , I tried running Redis in Docker.</p>
  <p>File <code>docker-compose.yml</code></p>
  <pre class="lang-yml prettyprint-override"><code>version: &quot;3.8&quot;
  
  services:
    redis:
      image: redis
      volumes:
        - ./data:/data
      ports:
        - 6379:6379
  </code></pre>
  <pre><code>docker pull redis
  docker-compose up
  docker-compose up -d
  docker container ls
  telnet localhost 6379
  </code></pre>
  
  <p>Telnet, type <code>PING</code> then press Enter key (you will not see text), then see result: <code>PONG</code>. Type <code>quit</code> to exit.</p>
  <pre><code>Microsoft Windows [Version 10.0.19041.508]
  (c) 2020 Microsoft Corporation. All rights reserved.
  
  D:\docker&gt;docker-compose stop redis
  Stopping docker_redis_1 ... done
  
  D:\docker&gt;
  </code></pre>
  <p>See what is running</p>
  <pre><code>docker container ls
  </code></pre>
  <p>You will see, docker redis was stoped.</p>
  <pre><code>docker image prune -a
  docker-compose up
  </code></pre>
  <p>Docker RedisInsight</p>
  <pre><code>docker run -v redisinsight:/db -p 8001:8001 redislabs/redisinsight:latest
  </code></pre>
  <p>Wait about 6 minutes (at internet speed at 22:30) for downloading, unzip, install, starting.</p>
  <p>go to: <a href="http://localhost:8001/" rel="nofollow noreferrer">http://localhost:8001/</a> (auto open web browser). Health check for RedisInsight http://localhost:8001/healthcheck/ is OK.</p>
  <p><a href="https://i.stack.imgur.com/8StWf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8StWf.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/nGL9l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nGL9l.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/FnJIx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FnJIx.png" alt="enter image description here" /></a></p>
  <p>(I also noted at here <a href="https://donhuvy.github.io/redis/docker/2020/10/10/run-redis-on-docker.html" rel="nofollow noreferrer">https://donhuvy.github.io/redis/docker/2020/10/10/run-redis-on-docker.html</a> )</p>
  <p>How to connect RedisInsight with Redis without error?</p>
  <p>Update: This is my host file, seemly have problem at here (IP <code>127.0.0.1</code> for Kubernetes, really I don't know about Kubernetes, I am learning it.), but I don't know how to fix.</p>
  <pre><code># Copyright (c) 1993-2009 Microsoft Corp.
  #
  # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
  #
  # This file contains the mappings of IP addresses to host names. Each
  # entry should be kept on an individual line. The IP address should
  # be placed in the first column followed by the corresponding host name.
  # The IP address and the host name should be separated by at least one
  # space.
  #
  # Additionally, comments (such as these) may be inserted on individual
  # lines or following the machine name denoted by a '#' symbol.
  #
  # For example:
  #
  #      102.54.94.97     rhino.acme.com          # source server
  #       38.25.63.10     x.acme.com              # x client host
  
  # localhost name resolution is handled within DNS itself.
  #   127.0.0.1       localhost
  #   ::1             localhost
  
  127.0.0.1    www.techsmith.com
  127.0.0.1    activation.cloud.techsmith.com
  127.0.0.1    oscount.techsmith.com
  127.0.0.1    updater.techsmith.com
  127.0.0.1    camtasiatudi.techsmith.com
  127.0.0.1    tsccloud.cloudapp.net
  127.0.0.1    assets.cloud.techsmith.com
  
  # Added by Docker Desktop
  192.168.1.44 host.docker.internal
  192.168.1.44 gateway.docker.internal
  # To allow the same kube context to work on the host and the container:
  127.0.0.1 kubernetes.docker.internal
  # End of section
  
  </code></pre>