Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash Docker没有';t运行入口点脚本_Bash_Docker - Fatal编程技术网

Bash Docker没有';t运行入口点脚本

Bash Docker没有';t运行入口点脚本,bash,docker,Bash,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 \

不明白为什么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,甚至将其移除-结果相同

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副本)之后运行了两个命令

图像生成&容器成功启动,在控制台中显示
Hello
。我不认为入口点是个问题

我会检查你的php.ini文件


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

您的操作系统是什么?我是Win,可能与编码、新行等有关吗?我添加了php。ini@ymakux我在MacOS上&再次用php.ini检查。一切看起来都很好。是的,
docker entrypoint.sh
文件中的新行可能有问题。请进行测试,如果您继续,我将删除我的答案(根据您问的人,答案可能应该是注释),问题似乎是:“[我]不明白为什么Docker[正在]忽略我的Docker endpoint.sh”。如果答案是:“Docker没有忽略Docker-endpoint.sh脚本,这实际上是php.ini的问题”,那么这就是问题的答案。
docker build . -t me/foo
docker run me/foo