title: Hostname not working with docker compose and redis
body: <p>I have a web application that makes use of a postgres database, a redis and an artemis server. All this working in docker containers but I can't get the application to connect to redis or artemis using the container name (with postgres it works). My docker compose:</p>
  <pre><code>version: '3.9'
  
  services:
    my_web_app:
      container_name: &quot;my_web_app&quot;
      image: my_image
      restart: always
      environment:
       REDIS_HOST: ${REDIS_HOST}
       REDIS_PORT: ${REDIS_PORT}
       ARTEMIS_HOST: ${ARTEMIS_HOST}
       ARTEMIS_PORT: ${ARTEMIS_PORT}
       ARTEMIS_USER: ${ARTEMIS_USER}
       JDBC_URL: ${JDBC_URL}
       JDBC_USERNAME: ${JDBC_USERNAME}
       JDBC_PASSWORD: ${JDBC_PASSWORD}
          ...
      ports:
        - 8080:8080
      depends_on:
        - my_redis
        - my_artemis
        - my_postgres
      networks:
        - my_network
  
    my_postgres:
      container_name: &quot;my_postgres&quot;
      image: &quot;postgis/postgis&quot;
      environment:
       POSTGRES_USER: ${JDBC_USERNAME}
       POSTGRES_PASSWORD: ${JDBC_PASSWORD}
       POSTGRES_DB: ${DB_NAME}
      ports:
        - 5432:5432
      networks:
        - my_network
  
    my_redis:
      container_name: &quot;my_redis&quot;
      image: redis
      ports:
        - 6379:6379
      networks:
        - my_network
  
  
    my_artemis:
      container_name: &quot;my_artemis&quot;
      image: vromero/activemq-artemis:2.16.0
      environment:
         ARTEMIS_USERNAME: quarkus
         ARTEMIS_PASSWORD: quarkus
         ENABLE_JMX_EXPORTER: &quot;true&quot;
      ports:
        - 61616:61616
        - 8161:8161
        - 5672:5672
      networks:
        - my_network:
  
  networks:
    my_network:
  </code></pre>
  <p>I have tried setting network aliases, domainname or hostname but nothing works.
  My health check:</p>
  <pre><code>{
      &quot;status&quot;: &quot;DOWN&quot;,
      &quot;checks&quot;: [
          {
              &quot;name&quot;: &quot;Database connections health check&quot;,
              &quot;status&quot;: &quot;UP&quot;
          },
          {
              &quot;name&quot;: &quot;Redis connection health check&quot;,
              &quot;status&quot;: &quot;DOWN&quot;,
              &quot;data&quot;: {
                  &quot;reason&quot;: &quot;client [&lt;default&gt;]: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:6379&quot;
              }
          },
          {
              &quot;name&quot;: &quot;Artemis JMS health check&quot;,
              &quot;status&quot;: &quot;DOWN&quot;
          }
      ]
  }
  </code></pre>
  <p>My .env:</p>
  <pre><code>REDIS_HOST=my_redis
  REDIS_PORT=6379
  ARTEMIS_HOST=my_artemis
  ARTEMIS_PORT=61616
  ARTEMIS_USER=quarkus
  ARTEMIS_PASSWORD=quarkus
  JDBC_URL=jdbc:postgresql://my_postgres:5432/my_db
  JDBC_USERNAME=quarkus
  JDBC_PASSWORD=quarkus
  DB_NAME=my_db
  </code></pre>
  <p>My quarkus application.properties</p>
  <pre><code>quarkus.artemis.url=tcp://${ARTEMIS_HOST}:${ARTEMIS_PORT}
  quarkus.artemis.username=${ARTEMIS_USER}
  quarkus.artemis.password=${ARTEMIS_PASSWORD}
  quarkus.redis.hosts=redis://${REDIS_HOST}:${REDIS_PORT}
  quarkus.datasource.jdbc.url=${JDBC_URL}
  quarkus.datasource.username=${JDBC_USERNAME}
  quarkus.datasource.password=${JDBC_PASSWORD}
  </code></pre>
  <p>My postgres setup (which works):</p>
  <blockquote>
  <p>jdbc:postgresql://my_postgres:5433/db_name</p>
  </blockquote>
  <p>My configuration for redis and artemis:</p>
  <blockquote>
  <p>redis://my_redis:6379</p>
  </blockquote>
  <blockquote>
  <p>tcp://my_artemis:61616</p>
  </blockquote>
  <p>The only thing that has worked is setting the network and fixed ips and using the ips instead of the container names but I want to use the container names. Any ideas?</p>