Skip to content

Build Image

Evil Wizard edited this page Nov 7, 2023 · 11 revisions

Build the Docker Image without using cached versions of previous image build stages.

The long Way

sudo docker build \
    -f php-5-6-apache.Dockerfile \
    --target build-php-56-apache \
    --no-cache \
    --build-arg NPM_VERSION=6.4.1 \
    -t php-5-6-apache:latest \
    .

Notes

  • Using -f php-5-6-apache.Dockerfile

    To specify php-5-6-apache.Dockerfile as the filename to build otherwise it is expected to be named just Dockerfile.

  • Using --target build-php-56-apache

    To select the build target stage[^multi_stage_builds_note] from the Dockerfile.

  • Using --no-cache

    To prevent using previous cached versions of image build stages.

  • Using --build-arg NPM_VERSION=6.4.1

    To set build arguments & values to use during the build process. NPM_VERSION=6.4.1 sets the Node Version to be used to 6.4.1 when rebuilding the image.

  • Using -t php-5-6-apache:latest

    To name & tag the locally built docker image.

  • Using .

    To set the current location as the build context for the build process.

Clone this wiki locally