【发布时间】:2021-02-22 06:07:38
【问题描述】:
所以我有 2 个 Dockerfile 来构建我的容器。第一个文件用于构建我的“主”(生产)容器,第二个文件扩展了第一个(通过 From 指令)并添加了一些开发和测试依赖项。
目前,我唯一的测试依赖是 Xdebug。我通过 PECL 安装它:RUN pecl install xdebug && docker-php-ext-enable xdebug
当我重建我的映像时,它似乎没有从头开始重建所有内容,所以我收到错误 pecl/xdebug is already installed and is the same as the released version 2.9.8 install failed ERROR: Service 'webapi' failed to build : The command '/bin/sh -c pecl install xdebug && docker-php-ext-enable xdebug' returned a non-zero code: 1
所以,好吧,它失败了,但我仍然安装了 Xdebug,所以我的图像可以正常工作。但它会停止构建。我不想。
我见过RUN command; exit 0 技巧,但正如有人提到的那样,它会消除任何真正的错误(如“抱歉,服务器无法访问,无法下载 Xdebug”)所以对我来说这不是一个可行的生产选项.
此外,apt-get 和 docker-php-ext-install 也无法使用 Xdebug。我被 PECL 困住了。
您是否知道任何选项(例如一些隐藏的参数)来执行“如果可以安装,否则就像滚动一样”之类的操作?
问候,
【问题讨论】:
标签: php docker dockerfile xdebug pecl