'org.springframework.web.client.ResourceAccessException: I/O error on POST request in docker

i have some issue about this. this my code

RestTemplate restTemplate = new RestTemplate();

        try {
            final String url = "https://xx.xx.xx/xx/xx;
            requestHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);

            logger.info(">>> HEADER  " + requestHeaders.toString());
            
            param.add("ocrImage", file.getResource());
    
        HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(param,requestHeaders);
            response = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
            logger.info(">>> RESPONSE BODY  " + response.getBody().toString());

when its running in localhost(intelj) , the results is good (get respone), but when its running in Docker , i have some issue :

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://url.com"; nested exception is java.net.UnknownHostException:https://url.com

can anyone help me with this issue.

Thanks You



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source