Example showing that actuator's port cannot be set at runtime via env variables.
mvn -Pnative spring-boot:build-image
docker run -p 8080:8080 -p 8082:8082 -e MANAGEMENT_SERVER_PORT=8082 --rm actuator-env-var:0.0.1-SNAPSHOT
This is the expected behavior. See spring-projects/spring-boot#35288.
As a workaround setting a default value for management.server.port
in the properties file then overriding it with the environment variable works.