This article will briefly show you how to use Docker for Laravel and MySQL application.

Create a .docker folder right inside the project’s root folder.

Then create a Dockerfile file with the following content.

FROM php:7.4.1-apacheUSER rootWORKDIR /var/www/htmlRUN apt-get update && apt-get install -y \libpng-dev \zlib1g-dev \libxml2-dev \libzip-dev \libonig-dev \zip \curl \unzip \&& docker-php-ext-configure gd \&& docker-php-ext-install -j$(nproc) gd \&& docker-php-ext-install pdo_mysql \&& docker-php-ext-install mysqli \&& docker-php-ext-install zip \&& docker-php-source deleteCOPY .docker/vhost.conf /etc/apache2/sites-available/000-default.confRUN curl -sS https://getcomposer.org/installer | php — — install-dir=/usr/local/bin…

Wai Hein

Software Developer based in the UK, used to work in Singapore, but originally from Myanmar.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store