title: Caused by: java.net.UnknownHostException: alc-vbox-testarchiveservice.minio with Minio and docker-compose
body: <p>We are using Minio for local testing of S3 AND we have created docker-compose file with Minio and our app dependency are as follows:</p>
  <p>Docker-Compose File:</p>
  <pre><code>version: &quot;2.1&quot;
  
  services:
    minio:
      image: minio/minio
      container_name: minio
      ports:
        - 9001:9001
      volumes:
        - minio_storage:/data
      environment:
        MINIO_ACCESS_KEY: minio
        MINIO_SECRET_KEY: minio123
        MINIO_REGION: us-east-1
      command: server /data --console-address &quot;:9001&quot;
      mem_limit: 512m
  
    populate-minio-data:
      container_name: &quot;minio-data&quot;
      image: minio/mc
      volumes:
        - ./hello.txt:/tmp/hello.txt
      entrypoint: &gt;
        /bin/sh -c &quot;
        /usr/bin/mc config host rm local;
        /usr/bin/mc config host add --quiet --api s3v4 local http://minio:9001 minio minio123;
        /usr/bin/mc mb --quiet local/somebucketname1/;
        /usr/bin/mc policy set public local/somebucketname1;
        /usr/bin/mc cp /tmp/hello.txt local/somebucketname1/hello.txt;
        &quot;
      depends_on:
        - minio
  
  
    archive-api-app:
      image: openjdk:11
      container_name: &quot;archive-api-app&quot;
      ports:
        - 8091:6001
      volumes:
        - /home/apcuser/dev/projects/ea-archive-service-v2/projects/application/archive-api:/app
      command: [ 'java', '-jar', '/app/build/libs/archive-api-1.0.0.jar' ]
      env_file:
        - ./vars/default.env
  
  volumes:
    minio_storage:
  </code></pre>
  <p>And In java code, I have configured MINIO URL as S3 Endpoint as follows:</p>
  <pre><code>@Bean
      public AmazonS3 getS3Client() {
          return AmazonS3ClientBuilder.standard()
                  .withClientConfiguration(new ClientConfiguration().withMaxConnections(maxConnections)
                          .withConnectionTimeout(connectionTimeout).withMaxErrorRetry(maxRetry))
              .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(&quot;http://minio:9001&quot;, &quot;us-east-1&quot;))
                  .build();
      }
  </code></pre>
  <p>Once, I run docker-compose file,I am able to see minio-ui in my local Linux machine as follows:
  <a href="https://i.stack.imgur.com/KfQ9G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KfQ9G.png" alt="enter image description here" /></a></p>
  <p>But when I am hitting API request from <code>postman</code> to my <code>archive-api-app</code>, App throwing below error:</p>
  <pre><code>    archive-api            |    at java.base/java.lang.Thread.run(Thread.java:829)
  archive-api            | Caused by: java.net.UnknownHostException: alc-vbox-testarchiveservice.minio
  archive-api            |    at java.base/java.net.InetAddress$CachedAddresses.get(InetAddress.java:797)
  archive-api            |    at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1519)
  archive-api            |    at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1378)
  archive-api            |    at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1306)
  archive-api            |    at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27)
  archive-api            |    at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38)
  archive-api            |    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112)
  archive-api            |    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
  archive-api            |    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  archive-api            |    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  archive-api            |    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  archive-api            |    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  archive-api            |    at com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76)
  archive-api            |    at com.amazonaws.http.conn.$Proxy97.connect(Unknown Source)
  archive-api            |    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
  archive-api            |    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
  archive-api            |    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
  archive-api            |    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
  archive-api            |    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
  archive-api            |    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
  archive-api            |    at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72)
  archive-api            |    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1346)
  archive-api            |    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1157)
  archive-api            |    ... 77 more
  </code></pre>
  <p>Does anyone know Why I am getting <code>UnknownHostException</code>? My doubt is since, I configured Minio-url(http://minio:9001) in the code where I am creating S3 configs, then why my code is trying to connect to <code>alc-vbox-testarchiveservice.minio</code> host? <strong>(My bucket name is:  alc-vbox-testarchiveservice)</strong></p>