Working dir discrepancy between docker exec and docker run

Hello,

I'm having trouble understanding why the current working directory isn't the same between these two options:

If I'm trying to run/debug something, the first option (run) acts as expected, getcwd() returns a value where my script is located (/var/www/html/test for exemple)

If I'm using the exec version, it's always returning the root directory of my app (/var/www/html) wich messes up all my chdir and requires.

I've seen this behaviour on both phpstorm/php-apache:8.0-xdebug3.0 and phpstorm/php-apache:7.4-xdebug2.9 images. Here are the docker-file and the compose file:

FROM phpstorm/php-apache:8.0-xdebug3.0
RUN apt-get update && apt-get install -y \
libzip-dev \
libpq-dev
RUN docker-php-ext-install zip pdo_mysql pdo_pgsql
php8debug:
build:
context: .
dockerfile: Php8_DockerFile
ports:
- "80:80"
volumes:
- ../:/var/www/html
environment:
PHP_IDE_CONFIG: serverName=localhost
XDEBUG_CONFIG: remote_host=host.docker.internal

Could someone help me with this issue?

 

 

 

0

I can confirm this behaviour, please check the following YouTrack report:
https://youtrack.jetbrains.com/issue/WI-60191

Not sure if any workaround is available at the moment.

1
Avatar
Permanently deleted user

Thanks for your feedback and the report.

0

请先登录再写评论。