docker composer code example
Example 1: docker compose run
docker-compose up --build -d --remove-orphans
docker-compose -f docker-compose.yml up --build -d --remove-orphans
Example 2: install composer in dockerfile
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Example 3: Composer install with dockerfile
version: '3.7'
services:
composer_installation:
container_name: composer_installation
image: composer
volumes:
- ./YOUR-PROJECT/:/app
command: sh -c "composer install --ignore-platform-reqs && cp .env.example .env && php artisan key:generate"
Example 4: list dockers docker compose
docker-compose ps