问题描述:

I get the following error when I run docker-compose:

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.

My docker-compose.yml

version: '2.0'

services:

app:

build: app

volumes:

- C:\Users\svirl\Documents\workspace\bgs-web:/var/www/html/:rw

and in app folder I have

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"]

and in same folder script.sh

#!/bin/bash

composer install

Is there something I missing?

网友答案:

The exec syntax of the entrypoint (with the json) needs the full path to the binary, or /var/www/html would need to be added to the path. Update your Dockerfile to the following:

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"]
相关阅读:
Top