LoginSignup
1
0

More than 3 years have passed since last update.

Docker コンテナ内で composer install/require したら `Could not find package` となった

Last updated at Posted at 2021-01-08

起こったこと

個人作成のアプリを作成中 docker のコンテナ内に入って、composer require laravel/laravel を実行したら以下のメッセージが出てきた。

[InvalidArgumentException]
Could not find package laravel/laravel with stability stable.

ちなみにローカルからだとうまくいく。
なんでやねーーーん!!

紆余曲折を経て最終的にやったこと

Dockerfile から composer をインストールしている以下の記述を削除

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
RUN composer config -g repos.packagist composer https://packagist.jp

マルチステージビルドを使用して composer を install する


COPY --from=composer:2.0.8 /usr/bin/composer /usr/bin/composer

終わったら docker image を ビルドして完了

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0