1、创建sprintboot项目。
@Controller
public class TestController {
@Resource
private UserService userService;
@GetMapping("haha")
@ResponseBody
public String haha() {
System.out.println("欢迎光临");
return "你好啊,docker里的springboot项目";
}
}
2、在springboot项目里,增加Dockerfile文件和.dockerignore文件
Dockerfile文件内容如下: