Hello, For created images with gradle bootBuildImage it is impossible to set the working_dir via docker-compose.

example

version: '3'
services:
  demo-service:
    restart: "no"
    image: demo:0.0.1-SNAPSHOT
    working_dir: /my-dir

In the runtime Spring writes (this is not only console bug) on the console

Starting AOT-processed BillingServiceApplicationKt using Java 17.0.5 with PID 1 (/workspace/[app main] started by cnb in /workspace)

Tested with - spring boot 3.0.2-SNAPSHOT, - gradle 7.6, - windows 10 Version 10.0.19045.2486, - openjdk version "18" 2022-03-22 - docker for windows 4.14.1 (91661)

Comment From: wilkinsona

There's no relationship between the current working directory and the directory in which the started application exists in the image. As you have seen, changing the working directory won't change the location of the application. Also, please note that this isn't native specific. It's also out of Spring Boot's control as the image creation is performed by cloud native buildpacks.

You haven't described what you were trying to achieve so I'm unable to provide any further suggestions. If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Comment From: Azbesciak

Ok, I did not add one detail to it - when I used File(".").absolutePath it returned also /workspace - that is the reason why I reported that issue, please see also discusion on Gitter: https://gitter.im/spring-projects/spring-boot?at=63c5a5164bbc000f0945e0c4

Comment From: wilkinsona

When discussing something on Gitter, please don't create an issue until that discussion has reached a conclusion. Doing so just splits the conversation into two places and risks wasting people's time.