Docker找不到文件

时间:2019-06-02 05:58:24

标签: docker

我正在研究一个将Docker映像用于特定功能的项目,除此之外,我根本不需要Docker,因此我对此不太了解。问题是Docker找不到文件夹中实际存在的文件,并且构建过程中断。

尝试使用docker build -t project/render-worker .创建图像时,错误是这样的:

Step 18/23 : RUN bin/composer-install  && php composer-setup.php --install-dir=/bin  && php -r 'unlink("composer-setup.php");'  && php /bin/composer.phar global require hirak/prestissimo
 ---> Running in 695db3bf2f02
/bin/sh: 1: bin/composer-install: not found
The command '/bin/sh -c bin/composer-install  && php composer-setup.php --install-dir=/bin  && php -r 'unlink("composer-setup.php");'  && php /bin/composer.phar global require hirak/prestissimo' returned a non-zero code: 127

如前所述,文件 composer-install 确实存在,并且是其中的内容:

#!/bin/sh

EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")"

if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
    echo 'ERROR: Invalid installer signature'
    rm composer-setup.php
fi

基本上,这是为了让您看到作曲家。

这是Docker文件:

FROM php:7.2-apache

RUN echo 'deb http://ftp.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
    libpq-dev \
    libxml2-dev \
    ffmpeg \
    imagemagick \
    wget \
    git \
    zlib1g-dev \
    libpng-dev \
    unzip \
    mencoder \
    parallel \
    ruby-dev
RUN apt-get -t stretch-backports install -y --no-install-recommends \
    libav-tools \
 && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install \
    pcntl \
    pdo_pgsql \
    pgsql \
    soap \
    gd \
    zip

RUN gem install compass
RUN a2enmod rewrite

ENV APACHE_RUN_USER root
ENV APACHE_RUN_GROUP root

EXPOSE 80

WORKDIR /app
COPY . /app

# Configuring apache to run the symfony app
COPY config/docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
RUN echo "export DATABASE_URL" >> /etc/apache2/envvars \
 && echo ". /etc/environment" >> /etc/apache2/envvars

RUN wget -cqO- https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz | tar -xJ
RUN cp -a node-v10.15.3-linux-x64/bin /usr \
 && cp -a node-v10.15.3-linux-x64/include /usr \
 && cp -a node-v10.15.3-linux-x64/lib /usr \
 && cp -a node-v10.15.3-linux-x64/share /usr/ \
 && rm -rf node-v10.15.3-linux-x64 node-v10.15.3-linux-x64.tar.xz

RUN bin/composer-install \
 && php composer-setup.php --install-dir=/bin \
 && php -r "unlink('composer-setup.php');" \
 # Install prestissimo for dramatically faster `composer install`
 && php /bin/composer.phar global require hirak/prestissimo

RUN APP_ENV=prod APP_SECRET= DATABASE_URL= AWS_KEY= AWS_SECRET= AWS_REGION= MEDIA_S3_BUCKET= \
    GIPHY_API_KEY= FACEBOOK_APP_ID= FACEBOOK_APP_SECRET= \
    GOOGLE_API_KEY= GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= STRIPE_SECRET_KEY= STRIPE_ENDPOINT_SECRET= \
    THEYSAIDSO_API_KEY= REV_CLIENT_API_KEY= REV_USER_API_KEY= REV_API_ENDPOINT= RENDER_QUEUE_URL= \
    CLOUDWATCH_LOG_GROUP_NAME= \
    php /bin/composer.phar install --no-interaction --no-dev --prefer-dist --optimize-autoloader --no-scripts \
    && php /bin/composer.phar clear-cache

RUN npm install \
 && node_modules/bower/bin/bower install --allow-root \
 && node_modules/grunt/bin/grunt

# Don't allow it to keep logs around; they're emitted on STDOUT and sent to AWS
# CloudWatch from there, so we don't need them on disk filling up the space
RUN mkdir -p var/cache/prod && chmod -R 777 var/cache/prod
RUN mkdir -p var/log && ln -s /dev/null var/log/prod.log \
    && ln -s /dev/null var/log/prod.deprecations.log && chmod -R 777 var/log

CMD ["/usr/bin/env", "bash", "./bin/start_render_worker"]

就像我说的那样,不幸的是,我对docker的工作原理和发生的事情一无所知,只是我需要它。我在Win10 Pro中运行docker,更糟糕的是,它实际上正在为另一个运行Win10的开发人员工作。我们尝试了一些方法,但无法使其正常工作。我尝试在其他位置克隆存储库,但完全没有成功。此特定步骤之前的所有操作均正常运行。


[ EDIT ]

根据用户的建议,我在作曲家安装行之前运行了RUN ls bin/,这是结果:

Step 18/24 : RUN ls bin/
 ---> Running in 6cb72090a069
append_captions
capture
composer-install
concat_project_video
console
encode_frames
encode_frames_to_gif
format_video_for_concatenation
generate_meme_bar
image_to_video
install.sh
phpcs
phpunit
process_render_queue
publish_docker_image
run_animation_worker
run_render_worker
run_render_worker_osx
start_render_worker
update
Removing intermediate container 6cb72090a069

您可以看到composer-install在那里,这真令人困惑。

我还检查了行结束序列并将其设置为LF,结果是相同的错误。


[第二编辑]

我添加了COPY bin/composer-install /bin 然后RUN ls bin/ 结果是一样的。 ls命令找到文件,但错误仍然存​​在。同样在bin之前添加斜杠不会改变任何内容:(

0 个答案:

没有答案