Skip to content

Composer Installation Failure in Docker for PHP Project #518

Open
@loyal812

Description

@loyal812

Environment

  • Operating System: [AWS EC2, Ubuntu 22.04]
  • Docker Version: [4.30]
  • PHP Version: [PHP 7.4]
  • Docker Image Used: [php:7.4-cli]

Issue Description

I am currently developing a PHP project using Docker, and I am encountering a recurring issue where Composer is not found during the setup process. This is preventing me from managing dependencies for my PHP project efficiently.

Expected Behavior

I expect Composer to be installed and available within the Docker container so that PHP dependencies can be managed and installed without any errors.

Actual Behavior

Whenever I attempt to install Composer dependencies or simply check the Composer version within the Docker container, I receive the following error:

docker build -t php-test .
/bin/sh: 1: composer: not found
The command '/bin/sh -c composer install' returned a non-zero code: 127

Attempts to Resolve

  • I have tried adding Composer directly in the Dockerfile using various snippets found in official documentation and forums such as:
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

However, the issue persists.

I have verified that PATH environment contains /usr/local/bin.

Request

I would appreciate any assistance on how to properly install and configure Composer within the Docker environment for PHP projects. If additional information is required, please let me know.

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions