Docker不运行入口点脚本

无法得到为什么Docker忽略我的docker-endpoint.sh

Dockerfile

FROM php:7.1-apache RUN a2enmod rewrite expires RUN set -ex \ && apt-get update \ && apt-get install -y --no-install-recommends \ libjpeg-dev \ libpng-dev \ libcurl4-openssl-dev \ && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-install opcache gd pdo_mysql zip WORKDIR /var/www/html COPY config/php/php.ini /usr/local/etc/php/ COPY docker-entrypoint.sh /usr/local/bin/ RUN set -xe \ chown -R www-data:www-data . \ && chmod +x /usr/local/bin/docker-entrypoint.sh ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["apache2-foreground"] 

docker-entrypoint.sh

 #!/bin/bash set -e echo "Hello" exec "$@" 

我希望看到“你好”。 容器启动正常,没有错误,但Apache不起作用。 Bash被安装。 我也尝试用#!/ bin / shreplace#!/ bin / bash,甚至删除它 – 相同的结果。

UPD。 php.ini中

 [PHP] ; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 120 ; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 256M ; Maximum size of POST data that PHP will accept. ; Its value may be 0 to disable the limit. It is ignored if POST data reading ; is disabled through enable_post_data_reading. ; http://php.net/post-max-size post_max_size = 10M ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 10M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. ; http://php.net/allow-url-fopen allow_url_fopen = Off [opcache] ; Determines if Zend OPCache is enabled opcache.enable=1 ; Determines if Zend OPCache is enabled for the CLI version of PHP opcache.enable_cli=1 ; The OPcache shared memory storage size. opcache.memory_consumption=128 ; The amount of memory for interned strings in Mbytes. opcache.interned_strings_buffer=8 ; The maximum number of keys (scripts) in the OPcache hash table. ; Only numbers between 200 and 100000 are allowed. opcache.max_accelerated_files=4000 ; How often (in seconds) to check file timestamps for changes to the shared ; memory storage allocation. ("1" means validate once per second, but only ; once per request. "0" means always validate) opcache.revalidate_freq=2 ; If enabled, a fast shutdown sequence is used for the accelerated code opcache.fast_shutdown=1 

我使用了Dockerfile&endpoint,并且在做了一个修改之后(注释掉php.ini副本),运行了两个命令:

 docker build . -t me/foo docker run me/foo 

构build的映像和容器已成功启动,在控制台中显示Hello 。 我不认为入口是一个问题。

我会检查你的php.ini文件。

如果您可以将其发布在您的原始问题中,并在添加时向我的答案添加评论,我将很高兴再次查看。