/bin/sh: 1: 作曲家: 未找到
/bin/sh: 1: composer: not found
我正在尝试构建 Dockerfile。
FROM php:7
RUN mkdir -p /home/winpc/test/laravelApp/app
WORKDIR /home/winpc/test/laravelApp/app
COPY composer.json /home/winpc/test/laravelApp/app
RUN composer install
COPY . /home/winpc/test/laravelApp/app
CMD php artisan serve --host=0.0.0.0 --port=8181
EXPOSE 8181
但是当我运行构建命令时它说:
docker build -t lar-app .
/bin/sh: 1: composer: not found
The command '/bin/sh -c composer install' returned a non-zero code: 127
但是当我只输入 composer 时,它会正确显示信息
我想问题出在命令上:
RUN composer install
这里我用的是Ubuntu14.04
正如 Stacktrace 所说,在 运行 composer
命令之前安装作曲家。
我添加了这些行:
RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet
RUN mv composer.phar /usr/local/bin/composer
因此您的 Dockerfile 将是:
FROM php:7
# Install composer:
RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet
RUN mv composer.phar /usr/local/bin/composer
RUN mkdir -p /home/winpc/test/laravelApp/app
WORKDIR /home/winpc/test/laravelApp/app
COPY composer.json /home/winpc/test/laravelApp/app
RUN composer install
COPY . /home/winpc/test/laravelApp/app
CMD php artisan serve --host=0.0.0.0 --port=8181
EXPOSE 8181
我正在尝试构建 Dockerfile。
FROM php:7
RUN mkdir -p /home/winpc/test/laravelApp/app
WORKDIR /home/winpc/test/laravelApp/app
COPY composer.json /home/winpc/test/laravelApp/app
RUN composer install
COPY . /home/winpc/test/laravelApp/app
CMD php artisan serve --host=0.0.0.0 --port=8181
EXPOSE 8181
但是当我运行构建命令时它说:
docker build -t lar-app .
/bin/sh: 1: composer: not found
The command '/bin/sh -c composer install' returned a non-zero code: 127
但是当我只输入 composer 时,它会正确显示信息 我想问题出在命令上:
RUN composer install
这里我用的是Ubuntu14.04
正如 Stacktrace 所说,在 运行 composer
命令之前安装作曲家。
我添加了这些行:
RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet
RUN mv composer.phar /usr/local/bin/composer
因此您的 Dockerfile 将是:
FROM php:7
# Install composer:
RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet
RUN mv composer.phar /usr/local/bin/composer
RUN mkdir -p /home/winpc/test/laravelApp/app
WORKDIR /home/winpc/test/laravelApp/app
COPY composer.json /home/winpc/test/laravelApp/app
RUN composer install
COPY . /home/winpc/test/laravelApp/app
CMD php artisan serve --host=0.0.0.0 --port=8181
EXPOSE 8181