从Dockerfile安装PHP作曲家
我尝试使用此代码在Dockerfile中安装作曲家,
FROM php:8.0-fpm
WORKDIR /app/php
RUN set update && set add curl && \
curl -sS https://getcomposer.org/installer --version=2.0.2 | PHP
但是当我执行容器时,我发现没有安装作曲家
root@70c:/app/php# composer -v
bash: composer: command not found
,这是怎么回事?
I tried to install composer in a dockerfile using this code
FROM php:8.0-fpm
WORKDIR /app/php
RUN set update && set add curl && \
curl -sS https://getcomposer.org/installer --version=2.0.2 | PHP
but when I exec the container I find that the composer isn't installed
root@70c:/app/php# composer -v
bash: composer: command not found
What's wrong?, and how can I resolve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将在您的目录中下载composer.phar文件,
如果您想对作曲家进行全局访问,则应将其移至/usr/local/bin目录并使其可执行。
chmod +x Composer.phar
sudo MV Composer.phar/usr/local/bin/bin/coposer
This will download the composer.phar file in the directory you are, in your case /app/php
If you want to have global access to composer you should move it to /usr/local/bin directory and make it executable.
chmod +x composer.phar
sudo mv composer.phar /usr/local/bin/composer