When composer install/require in the Docker container, it becomes `Could not find package`

What happened

Creating a personalized app When I entered the docker container and ran composer require laravel/laravel, I got the following message:

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

By the way, it works well from the local. Why isn't it! !!

What I finally did after many twists and turns

Removed the following description of installing composer from Dockerfile

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

Install composer using a multi-stage build


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

When you're done, build docker image and you're done

Recommended Posts

When composer install/require in the Docker container, it becomes `Could not find package`
What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
What to do when a could not find driver appears when connecting to a DB in a Docker environment
What to do if Could not find hoge in any of the sources Run `bundle install` to install missing gems. Appears in the docker container
MySQL container does not start in Docker
[Rails & Docker & MySQL environment construction] Could not find gem ‘mysql2 (> = 0.4.4, <0.6.0)’ in any of the gem sources listed in your Gemfile.
What I did when I was addicted to the error "Could not find XXX in any of the sources" when I added a Gem and built it
Could not find coderay-1.1.3 in any of the sources (Bundler :: GemNotFound) during co-development
When I run the source command in the Ubuntu Makefile, it says "source: command not found"
How to check the logs in the Docker container
How Docker works ~ Implement the container in 60 lines
When the project is not displayed in eclipse
One of the causes and solutions when whales do not appear in Docker Quickstart Terminal
When rewriting the CMD of docker image of Pod in the manifest of k8s, command is not good
What to do when Rails on Docker does not reflect controller changes in the browser
What to do when it becomes Unable to find CDI BeanManager.
Host specification when laravel php artisan serve in docker container
The case that @Autowired could not be used in JUnit5
When [command not found: composer] is displayed when [composer install] is displayed in Laravel
Docker does not work when DOCKER_HOST is specified in WSL2