无法理解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 / sh替换#!/ 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
答案 0 :(得分:1)
我使用了你的Dockerfile&端点,并在进行一次修改(注释掉php.ini副本)后运行了两个命令
docker build . -t me/foo
docker run me/foo
图像构建&容器已成功启动,在控制台中显示Hello
。我不认为ENTRYPOINT是一个问题。
我会检查你的php.ini文件。
如果您可以将其发布在原始问题中,并在添加评论后添加评论我很乐意再次审核。