Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error retrieving current directory: getcwd in Docker container

Tags:

php

docker

I'm running the 'php:7.4-fpm' container to server a laravel application. When I tried to ssh into the container, I got the following error:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

This happened suddenly, I'm working on this project for almost 3 months and had never faced this scenario. My host machine is a mac, catalina (version 10.15.3)

I can run other commands like php/ php artisan etc but its taking too long to respond and also any command related to directories like getcwd/pwd etc are not working.

Why does this happen?

It works fine after restarting the containers but is there permantent solution?

like image 298
Aryan Ahmed Anik Avatar asked Dec 03 '25 03:12

Aryan Ahmed Anik


1 Answers

Just encountered same issue. For me rootcause was, that the current folder I'm in was deleted. So solution - check if current folder exists, and cd to an existing one, if current is deleted.

like image 162
Omniptizator Avatar answered Dec 05 '25 18:12

Omniptizator



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!