Open jarri-abidi opened 4 years ago
what does echo $PWD
show ?
Also not sure why you need the $@ there as there are no arguments to pass (I assume the snippet above is from a script and not being ran directly ?
$PWD
is set.
And yes it's from a script but this is all that is inside the script.
test changing $PWD
to "D:\Projects\server-docker"
Getting Docker working well under Windows 10 is a challenge. If you are using Docker under WSL2 then your files should be inside of the WSL environment; e.g. /home/<USER>/projects/*
and accessed under Windows via \\wsl$\<DISTRO>
.
Using this setup, which is the recommended way to do things under WSL2 for maximum performance, the below is what I am getting on Windows 10, WSL2 Ubuntu 20.
This:
alias composer="docker run -it --rm -u $UID -v ${pwd}:/app composer"
did not work; I get:
me@laptop ~/projects/sites/website (master)$ composer install
Composer could not find a composer.json file in /app
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
This:
alias composer="docker run -it --rm -u $UID -v `pwd`:/app composer"
works for me, but only if you source ~/bashrc
while inside the project root:
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- Root composer.json requires php ^7.2.5 but your php version (8.0.2) does not satisfy that requirement.
That got me thinking, this is the only way I could get it to work from any directory:
function composer()
{
DIR=`pwd`
docker run -it --rm -u $UID -v $DIR:/app composer $1 $2
}
This may offer future readers some assistance using the Dockerized composer image under WSL2, but I am still not able to use it for projects < php 8.0.2. See https://github.com/phpguru/docker-php-composer/tree/php7.4
Personally I use the following alias for composer: https://github.com/alcohol/dotfiles/blob/main/bin/composer
In regards to PHP versions, please see our documentation: https://github.com/docker-library/docs/tree/master/composer#php-version--extensions
Didn't mean to close this.
I have the same problem running it as a Gitlab-CI job via docker-dind, $PWD
points to the right directory and ls -l
shows the correct content.
I'm using this yml file, seems ok to me but gitlab-runner keeps saying there's no composer.json
.
Can't provide access to the gitlab-runner, is in a place where only god knows how to reach from outside... and i doubt the IT guys would allow me to share.
@phpguru
alias composer="docker run -it --rm -u $UID -v ${pwd}:/app composer"
Try using single quotes.
command being run:
output:
ls
output: