Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to run a docker command keeps giving me absolute path error

Tags:

docker

laravel

Wanted to install laravel under windows 10 using git bash and it keeps giving me an error:

docker run --rm -v /d/programming/test/:/opt -w /opt laravelsail/php80-composer:latest bash -c "laravel new example-app && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailhog,selenium"

Error: docker: Error response from daemon: the working directory 'C:/Program Files/Git/opt' is invalid, it needs to be an absolute path.

I've tried $(pwd), d:\...... /d/.... but it keeps giving that error.

No idea how to resolve this :-/

like image 208
Multiplexor Avatar asked Sep 18 '25 12:09

Multiplexor


1 Answers

That's from Git Bash, it's converting paths to it's directory. To override that, use a double slash on the paths:

docker run --rm -v //d/programming/test/:/opt -w //opt laravelsail/php80-composer:latest bash -c "laravel new example-app && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailhog,selenium"
like image 182
BMitch Avatar answered Sep 23 '25 07:09

BMitch