1. 导入jar包
 <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.session</groupId>
    <artifactId>spring-session-data-redis</artifactId>
</dependency>
  1. 在启动类上加上注解@EnableRedisHttpSession
  2. 启动redis
  3. 删除正在运行的容器
  4. 项目打包发布到docker
  5. 测试

改项目端口

  1. pom.xml改名
    .
  2. 改端口号
  3. 改dockerFile端口号8081


4. 改docker