简体   繁体   English

找不到 Docker 命令中 Alpine 下的 PHP7

[英]PHP7 under Alpine in Docker command not found

When I run an interactive shell for the container there definitely is a PHP binary:当我为容器运行交互式 shell 时,肯定有一个 PHP 二进制文件:

sudo docker run -t -i neekoy/php7 /bin/sh

/ # which php-fpm7

/usr/sbin/php-fpm7

But when I run that same container I get the following:但是当我运行同一个容器时,我得到以下信息:

sudo docker run neekoy/php7

/bin/sh: [php-fpm7]: not found

This is my Dockerfile:这是我的 Dockerfile:

FROM alpine:latest

RUN apk update

RUN apk add php7-fpm php7-mcrypt php7-soap php7-openssl php7-gmp php7-pdo_odbc php7-json php7-dom php7-pdo php7-zip php7-mysqli php7-sqlite3 php7-apcu php7-pdo_pgsql php7-bcmath php7-gd php7-odbc php7-pdo_mysql php7-pdo_sqlite php7-gettext php7-xmlreader php7-xmlrpc php7-bz2 php7-iconv php7-pdo_dblib php7-curl php7-ctype

EXPOSE 9000

CMD ['php-fpm7']

I've stripped out the config changes because they're irrelevant.我删除了配置更改,因为它们无关紧要。

System info:系统信息:

Container:容器:

cat /etc/ release猫 /etc/发布

3.7.0 3.7.0

NAME="Alpine Linux" NAME="Alpine Linux"

My PC:我的电脑:

docker -v码头工人 -v

Docker version 17.12.1-ce, build 7390fc6 Docker 版本 17.12.1-ce,构建 7390fc6

The problem is that single quotes ' do not work - according to the documentation the argument is parsed as JSON-array.问题是单引号'不起作用 - 根据文档,参数被解析为 JSON 数组。 So the correct "CMD"-line would look like this:所以正确的“CMD”行看起来像这样:

CMD ["php-fpm7", "-F"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM