skip to Main Content
$docker-compose build
mv: cannot stat '/root/.symfony/bin/symfony': No such file or directory
ERROR: Service 'www_symfony_colcot' failed to build: The command '/bin/sh -c echo "ServerName localhost" >> /etc/apache2/apache2.conf     &&  apt-get

Normaly auto generated by docker-compose.yml

docker-compose.yml :

version: "3.5"
services:         
    db_symfony_colcot:
        image: mariadb:10.5.13
        container_name: db_symfony_colcot
        command: [ "--default-authentication-plugin=mysql_native_password" ]
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: gsbgenerique
          MYSQL_DATABASE: colcot
          MYSQL_USER: gestionnaire
          MYSQL_PASSWORD: gsbgenerique
        volumes:
          - ./initSQL/:/docker-entrypoint-initdb.d/
          - "./datamysql-colcot:/var/lib/mysql"
        ports:
          - "3311:3306"
        networks:
          - dev-sym

    www_symfony_colcot:
        build: php
        container_name: www_symfony_colcot
        ports:
          - "8094:80"
        user: 0:0
        volumes:
            - ./php/vhosts:/etc/apache2/sites-enabled
            - /home/marc/Desktop/colcot/colcot-2022/Colcot/:/var/www
        restart: always
        networks:
            - dev-sym

networks:
    dev-sym:

volumes:
    db-data:


Dockerfile :

FROM php:7.4-apache

RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf 

    &&  apt-get update 
    &&  apt-get install -y --no-install-recommends 
        locales apt-utils git libicu-dev g++ libpng-dev libxml2-dev libzip-dev libonig-dev libxslt-dev unzip 

    &&  echo "en_US.UTF-8 UTF-8" > /etc/locale.gen  
    &&  echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen 
    &&  locale-gen 

    &&  curl -sS https://getcomposer.org/installer | php -- 
    &&  mv composer.phar /usr/local/bin/composer 

    &&  curl -sS https://get.symfony.com/cli/installer | bash 
    &&  mv /root/.symfony/bin/symfony /usr/local/bin 
    &&  useradd -m symfony -u 1001 
 
    &&  docker-php-ext-configure 
            intl 
    &&  docker-php-ext-install 
            pdo pdo_mysql opcache intl zip calendar dom mbstring gd xsl 

    &&  pecl install apcu && docker-php-ext-enable apcu

WORKDIR /var/www/

Error caused by line :

&&  mv /root/.symfony/bin/symfony /usr/local/bin 

How can i solve this error please. Btw im beginner with docker but this project was working since 5 month ago.

Already try :

  • Change mariadb version
  • All php version ( from 5.6 to 8 )
  • Change dockercompose version

Result : Still not working and same error

2

Answers


  1. The command you are using to install symfony:

    curl -sS https://get.symfony.com/cli/installer | bash
    

    Is installing Symfony version 5. The files are located in symfony5 folder (notice the 5):

    The Symfony CLI was installed successfully!
    
    Use it as a local file:
      /root/.symfony5/bin/symfony
    

    So instead of running mv /root/.symfony/bin/symfony /usr/local/bin (.symfony folder does not exist), you should run:

    mv /root/.symfony5/bin/symfony /usr/local/bin
    

    By the way, as of 2022, using this script seems not to be the recommended method anymore: see https://symfony.com/download.

    For info, the commit who changes the folder in the script from .symfony to .symfony5 is this one: https://github.com/symfony-cli/symfony-cli/commit/5301ebfa8f5918cae7fa0bf63c86f84dbd70f599.

    Login or Signup to reply.
  2. I will add that in order to understand whether version 5 has changed to some other, you can look at the installer file (https://get.symfony.com/cli/installer) itself. Now (at the time of writing this comment) there is such information:

    CLI_CONFIG_DIR=".symfony5"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search