There is a docker-copmose.yml file. You need to install the copmoser container to deploy the application correctly. How can this be done?

Docker-compose.yml Description

version: '2' services: nginx: image: evild/alpine-nginx:1.9.15-openssl container_name: lemp_nginx restart: always links: - php volumes: - ./project:/var/www/ - ./docker/nginx/conf/nginx.conf:/etc/nginx/conf/nginx.conf:ro - ./docker/nginx/conf.d:/etc/nginx/conf.d:ro ports: - 8080:80 - 443:443 php: image: evild/alpine-php:7.0.6 working_dir: /var/www container_name: lemp_php restart: always volumes: - ./project:/var/www/ depends_on: - db links: - db environment: - DB_NAME=mysql - DB_USER=root - DB_PASSWORD=password db: image: mariadb:latest container_name: lemp_mariadb restart: always volumes: - db-data:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=password volumes: db-data: driver: local 

    1 answer 1

    Create a Dockerfile file with the following contents.

     FROM evild/alpine-php:7.0.6 RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" RUN php composer-setup.php RUN php -r "unlink('composer-setup.php');" RUN mkdir -p /usr/local/bin RUN mv composer.phar /usr/local/bin/composer 

    Change your docker-compose.yml . Instead of image: evild/alpine-php:7.0.6 prescribe build: .

    • describe further action - ruslik
    • I did as you describe, I go into the php container, then I enter the composer install -> command not found - ruslik
    • @ruslik how do you enter the container? - Mikhail Vaysman
    • docker exec -it lemp_mariadb sh - ruslik
    • And when I first installed it, I received a message that the composer was installed in var / www / html, but I do not have such a folder in the container - ruslik