arm容器启动spring-boot端口报错

问题描述:

2025-08-31T14:38:31.206+08:00 ERROR 1 --- [spring-boot-nginx-test] [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************

APPLICATION FAILED TO START

***************************

Description:

Invalid value 'tcp://192.168.180.154:8091' for configuration property 'server.port' (originating from 'System Environment Property "SERVER_PORT"'). Validation failed for the following reason:

Failed to convert to type java.lang.Integer

Additionally, this property is also set in the following property source:

  • In 'Config resource 'file [config/application.yaml]' via location 'optional:file:./config/'' with the value '8080' (originating from 'URL [file:config/application.yaml] - 10:9').

Action:

Review the value of the property with the provided reason.

解决:

server.port=8080

management.server.port=8081

复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  name: spring-boot-nginx-test
  namespace: dev
  labels: 
    app: spring-boot-nginx-test
spec: 
  replicas: 1
  selector:
    matchLabels:
      app: spring-boot-nginx-test
  template:
    metadata:
      labels:
        app: spring-boot-nginx-test
    spec:
      containers:
        - name: spring-boot-nginx-test
          image: spring-boot-nginx-test
          imagePullPolicy: IfNotPresent
          env:
            - name: SERVER_PORT
              value: "8080"
            - name: MANAGEMENT_SERVER_PORT
              value: "8081"
            - name: "JAVA_OPT"
              value: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9527"
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
            - name: debug
              containerPort: 9527
              protocol: TCP
          volumeMounts:
            - name: date
              mountPath: /etc/localtime
      volumes:
        - name: date
          hostPath:
            path: /etc/localtime
---
apiVersion: v1
kind: Service
metadata:
  name: spring-boot-nginx-test
  namespace: dev
  labels:
    app: spring-boot-nginx-test
spec:
  type: NodePort
  ports:
    - name: http
      port: 8080
      targetPort: 8080
    - name: debug
      port: 9527
      targetPort: 9527
  selector:
    app: spring-boot-nginx-test