My way of downloading a file from a docker is by using:
Backend
url = "http://" + settings.getDockerIP() + ":" + settings.getDockerPort() + "/containers/" + container.getId() + "/archive?path=/path";
Frontend
<div class="fm-file-icon">
<a href="${file}"><img src="../resources/img/folder.png"></a>
</div>
Controller
@RequestMapping("/report")
public ModelAndView report(HttpServletRequest request) {
String environmentName = request.getParameter("name");
ModelAndView model = new ModelAndView("report");
model.addObject("file", Report.getFileFromContainer(environmentName));
return model;
}
The problem is that to download the file you also need a connection to settings.getDockerIP():settings.getDockerPort()
and I don't want that. I just want to be able for the user to download the file by accessing the site without having the connection to the docker itself.
How can I do this? Maybe I need to download the file on the backend and then pass the url to the file in my server?