2017-02-21 45 views
1

我收到以下錯誤,當我運行搬運工-撰寫:

Cannot start service app: oci runtime error: container_linux.go:247: starting container process caused "exec: \"script.sh\": executable file not found in $PATH" 
ERROR: Encountered errors while bringing up the project. 

我的搬運工,compose.yml

version: '2.0' 

services: 
    app: 
    build: app 
    volumes: 
     - C:\Users\svirl\Documents\workspace\bgs-web:/var/www/html/:rw 

app文件夾我有

Dockerfile

FROM php:5.6-apache 
WORKDIR /var/www/html/ 

ADD script.sh /var/www/html 
RUN chmod +x /var/www/html/script.sh 
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 
ENTRYPOINT ["script.sh"] 

並在同一個文件夾script.sh

#!/bin/bash 
composer install 

有什麼我失蹤?

回答

1

入口點的exec語法(帶有json)需要二進制文件的完整路徑,否則需要將/ var/www/html添加到路徑中。更新您的Dockerfile以下幾點:

FROM php:5.6-apache 
WORKDIR /var/www/html/ 

ADD script.sh /var/www/html 
RUN chmod +x /var/www/html/script.sh 
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 
ENTRYPOINT ["/var/www/html/script.sh"] 
+1

我很抱歉,但現在我得到'錯誤:應用程序無法啓動服務程序:OCI運行時錯誤:container_linux.go:247:啓動容器過程中造成「EXEC:\」/var/www/html/script.sh \「:stat /var/www/html/script.sh:沒有這樣的文件或目錄」',但文件是我在docker-compose上運行ls -la'。 –

+0

包括你的docker-compose.yml。很可能您正試圖在/ var/www/html路徑中的某處加載卷。 – BMitch

+0

是的,你是對的,我更新了代碼。 –

相關問題