When constructing based on Jenkins, an error is reported:composer installReturned a non-zero code: 255 solution
1. The code of the Dockerfile is as follows:
from registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php71:0.2.4 Maintainer wjtester@sobey.com 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
2. When building based on Jenkins, the details of the error are as follows, as shown in Figure 1
Step 4 : copy code/build/c_files/ / ---> f287879fb9ba Removing Intermediate Container 8E0F70E90E2B Step 5 : run chown -r nginx:nginx /sobey/www/ & & rm -rf /etc/nginx/conf.d/status.conf && chmod +x /usr/local/bin/composer & cd install --no-dev ---> running in 0c4904881ff7 The command/bin/sh -c chown -r nginx:nginx /sobey/www/ && rm -rf /etc/nginx/conf.d/status.conf && chmod +x /usr/local/bin/composer & cd install --no-devReturned a non-zero code: 255 Build stepDocker build and publishMarked build as failure Finished: Failure
3. Edit the dockerfile, temporarily cancel the composer related, after the build is successful, run composer -v in the docker container, no response, as shown in Figure 2
from registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php71:0.2.4 Maintainer wjtester@sobey.com 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
4. Edit the Dockerfile, edit the configuration in php.ini: open_basedir (add a directory tree of files that php can open /usr/local/php/), allow_url_fopen, as shown in Figure 3
from registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php71:0.2.4 Maintainer wjtester@sobey.com run sed -is/open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv/;open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv:\/usr\/local\/php/g/usr/local/php/etc/php.ini && \ sed-is/allow_url_fopen = off/allow_url_fopen = on/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
5. When it is built based on Jenkins, it is in line with expectations, as shown in Figure 4


