1、由于无法从 dist 下载 yiisoft/yii2-composer (2.0.7),现在尝试从源代码下载,Process 类依赖于 proc_open ,这在PHP安装中不可用,如图1
2、编辑 Dockerfile,在 disable_functions 中删除 proc_open、proc_close
FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php71:0.2.4 MAINTAINER wjtester@sobey.com RUN sed -i 's/open_basedir = .//://sobey://tmp://data://webtv/;open_basedir = .//://sobey://tmp://data://webtv://usr//local//php/g' /usr/local/php/etc/php.ini && / sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && / sed -i 's/disable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show/disable_functions = system,passthru,shell_exec,escapeshellarg,escapeshellcmd,dl,popen,show/g' /usr/local/php/etc/php.ini COPY code /sobey/www/pcs-api COPY code/build/c_files/ / RUN chown -R nginx:nginx /sobey/www/ && / rm -rf /etc/nginx/conf.d/status.conf && / chmod +x /usr/local/bin/composer && / cd /sobey/www/pcs-api && / composer install
3、之前 proc_open、proc_close 也是禁用的,可以正常构建,原因在于可以从 dist 正常下载 yiisoft/yii2-composer (2.0.6),因此,不会从源代码下载,也就不会使用到 proc_open、proc_close,如图2
4、重新构建镜像,从源代码下载成功,构建成功,如图3
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/181175.html