title: Run Redis on docker network mode host
body: <p>I want to run network mode as host for Redis cluster in docker.</p>
  <p>The command to execute in the <a href="https://hub.docker.com/_/redis" rel="nofollow noreferrer">redis image of docker hub</a>, is written as follows.</p>
  <pre><code>docker run --name some-redis -d redis
  </code></pre>
  <p>After performing port mapping by giving the -p option as follows:</p>
  <pre><code>docker run -p 6379:6379 --name some-redis redis
  </code></pre>
  <p>If you connect to redis-cli, the connection is good.</p>
  <pre><code>&gt; redis-cli -p 6379
  
  127.0.0.1:6379&gt;
  </code></pre>
  <p>If you look at the network with docker container inspect some-redis, the default network mode is bridge.</p>
  <pre><code>&quot;Networks&quot;: {
                  &quot;bridge&quot;: {
                      &quot;IPAMConfig&quot;: null,
                      &quot;Links&quot;: null,
                      &quot;Aliases&quot;: null,
  </code></pre>
  <p>I tried to proceed with the host.</p>
  <pre><code>docker run --net=host -p 6379:6379 --name some-redis redis
  </code></pre>
  <pre><code>WARNING: Published ports are discarded when using host network mode
  </code></pre>
  <p>If a phrase such as, is displayed, the port is not disclosed.</p>
  <pre><code>CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS          PORTS                                            NAMES
  6f4edb2c4f8a   redis                        &quot;docker-entrypoint.s…&quot;   5 seconds ago    Up 4 seconds                                                     some-redis
  </code></pre>
  <p>Of course, you can't even connect to redis-cli.</p>
  <pre><code>&gt; redis-cli -p 6379
  
  Could not connect to Redis at 127.0.0.1:6379: Connection refused
  not connected&gt;
  </code></pre>
  <p><a href="https://stackoverflow.com/questions/35586778/docker-container-doesnt-expose-ports-when-net-host-is-mentioned-in-the-docker">Docker container doesn&#39;t expose ports when --net=host is mentioned in the docker run command</a></p>
  <p>Looking at the above question, it seems that the port should be automatically public.</p>
  <p>How can I expose ports in network mode host in docker redis?</p>