Question

Docker deploy to app platform fails while local build succeeds (/proc/1/mem: input/output error)

Posted December 6, 2021 172 views
DockerDigitalOcean App Platform

Hi there! I just tried to deploy a new Docker app to the app plattform and keep getting a strange error while attempting to run a simple apk update:

No cached layer found for cmd RUN apk update 
[2021-12-06 10:17:58] error building image: error building stage: failed to optimize instructions: read /proc/1/mem: input/output error
[2021-12-06 10:17:58] 
[2021-12-06 10:17:58] command exited with code 1
[2021-12-06 10:17:58] du: /proc/203: No such file or directory
[2021-12-06 10:17:59]  ! Build failed (exit code 1)

Building locally works just fine and I’m using the same Dockerfile with other projects where it works without a complaint.

Any ideas?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

I figured my issue out in the end.
Even though the deployment failed at the first RUN command the actual issue was further down.

The COPY .. /app/ statement tries to access a directory outside of my project and that’s what made the whole build fail. I changed it to COPY . /app/ and everything worked.

FROM webdevops/php-apache:8.0-alpine
WORKDIR /app

ENV WEB_DOCUMENT_ROOT=/app/public

COPY docker/config/provision/ /opt/docker/provision/

RUN docker-service enable cron \
    && apk update \
    && apk add --no-cache libpng-dev g++ make bash zlib-dev nano php8-bcmath php8-mysqli php8-pdo php8-pdo_mysql redis \
    && echo "APP_KEY=" > .env

COPY composer.json composer.lock /app/

RUN composer install --ignore-platform-reqs --no-scripts

COPY .. /app/

RUN composer run-script post-autoload-dump \
    && php artisan key:generate \
    && chown -R application:application * \
    && find . -type d -exec chmod 775 {} \; \
    && find . -type f -exec chmod 664 {} \; \
    && find /opt/docker/bin/service.d/* -type f -exec chmod 775 {} \;

ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
CMD ["supervisord"]

Hi There,
What droplet are you using in DO ?

Also, can you put the Dockerfile or docker-compose file here ?

BR

  • Hi, thanks for your response!

    I’m not using a Droplet, I’m using the App platform.

    Here’s my Dockerfile. Note that I’ve slightly modified it since posting but it still leads to the same error.

    No matter what I place in the first RUN statement it produces the above mentioned error when deploying

    FROM webdevops/php-apache:8.0-alpine
    WORKDIR /app
    
    ENV WEB_DOCUMENT_ROOT=/app/public
    
    COPY docker/config/provision/ /opt/docker/provision/
    
    RUN docker-service enable cron \
        && apk update \
        && apk add --no-cache libpng-dev g++ make bash zlib-dev nano php8-bcmath php8-mysqli php8-pdo php8-pdo_mysql redis \
        && echo "APP_KEY=" > .env
    
    COPY composer.json composer.lock /app/
    
    RUN composer install --ignore-platform-reqs --no-scripts
    
    COPY .. /app/
    
    RUN composer run-script post-autoload-dump \
        && php artisan key:generate \
        && chown -R application:application * \
        && find . -type d -exec chmod 775 {} \; \
        && find . -type f -exec chmod 664 {} \; \
        && find /opt/docker/bin/service.d/* -type f -exec chmod 775 {} \;
    
    ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
    CMD ["supervisord"]