docker-compose.yml
version: '3' services: web: build: . ports: - 80:80 volumes: - ./:/var/www/html Dockerfile
FROM php:7.2-apache # Set public directory as root for Apache ENV APACHE_DOCUMENT_ROOT=/var/www/html/public RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf WORKDIR /var/www/html RUN apt-get update \ && apt-get install -y git \ && curl --silent --show-error https://getcomposer.org/installer | php \ && php composer.phar install Composer generates an error when installing dependencies
ERROR: Service 'web' failed to build: The command '/ bin / sh -c apt-get update && apt-get install -y git && curl --silent --show-error https://getcomposer.org/installer | php && php composer.phar install 'returned a non-zero code: 1
Moreover, if you go directly to the container and perform the installation through the composer, then everything works.
FROM php:7.2-fpm- Senior PomidorComposer could not find a composer.json file in /var/www/html. You can fix this by running./composer.phar global require "laravel/installer", but for this you need to install additional components again. Or, it will be easier if you use FROM php: 7.2-fpm - Senior Pomidor