2016-12-13 76 views
3

我在PHP-FPM 7.1的Dockerfile中工作。我結束了Dockerfile與以下行:

CMD ["php71-php-fpm"] 

因爲我使用docker-compose我這是怎麼啓動的容器:

docker-compose up -d 

容器編譯罰款(顯然)按本線:

Successfully built 014e24455b53 
WARNING: Image for service php was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. 
Creating php71-fpm 

但它與下面的錯誤結束:

ERROR: for php Cannot start service php: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"php71-php-fpm\\\": executable file not found in $PATH\"\n" 
ERROR: Encountered errors while bringing up the project. 

我曾嘗試以下:

CMD php71-php-fpm 

和錯誤消失,但然後用代碼127的容器出口:

> docker-compose ps 
    Name    Command    State  Ports 
------------------------------------------------------- 
php71-fpm /bin/sh -c php71-php-fpm Exit 127 

我是缺少在這裏?

UPDATE

我已經找到了以下的答案here

Value 127 is returned by /bin/sh when the given command is not found within your PATH system variable and it is not a built-in shell command. In other words, the system doesn't understand your command, because it doesn't know where to find the binary you're trying to call.

這讓我覺得,沒有被執行文件php71-paths.sh這樣的路徑是不正確安裝。

再次,我失蹤了?

php71-fpm將運行Nginx的另一個容器鏈接(這是一個在製品和我的方式來學習泊塢窗)

這是完整的Dockerfile給你看看。

回答

2

我相信你會遇到麻煩,因爲Docker運行的默認shell不是根據this answer的登錄shell,這意味着/etc/profile.d/中的腳本不會被處理。

如果您需要配置文件處理,請嘗試將最後一行更改爲CMD ["/bin/sh", "-l", "-c", "php71-php-fpm"]以調用登錄shell。

+0

我得到了和以前一樣的結果 – ReynierPM

+0

您確定圖像上存在可執行文件嗎?在你的映像上找到/ -name php71-php-fpm1'只能在'/etc/logrotate.d'中找到一個條目 – shiv

+0

**注意**我原本在我的答案中忘記了'-c'。對於那個很抱歉。但使用'CMD [「env」]''CMD [「/ bin/sh」,「-l」,「-c」,「env」]運行映像會在PATH中顯示相關的php dirs ' – shiv

相關問題