PHP

DevOps Docker Use case: Web PHP

Using docker to run the composer command

Using latest version of the composer

docker run --rm --interactive --tty \
  --volume $PWD:/app \
  composer require psr/log "^1.0"

Using the specific version of the composer

docker run --rm --interactive --tty \
  --volume $PWD:/app \
  composer:1.9.3 require psr/log "^1.0"

Docker Composer with GD library

FROM composer:1.9.3

# Install required packages
RUN apk --no-cache add php7-gd freetype-dev libjpeg-turbo-dev libpng-dev


RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
  && docker-php-ext-install -j "$(nproc)" gd

Reference