Cannot read resource files or refer them in Docker with Spring Boot

I use Spring Boot 2 and Thymeleaf as a frontend framework. And Thymeleaf is referring to templates that are located in src/main/resources/template folder. It is working fine. But when I try to run it in Docker my controller class cannot retrieve templates from resources.

How to make the resources folder available in Docker?

Source: StackOverflow