Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.74 KB

README.md

File metadata and controls

56 lines (40 loc) · 1.74 KB

Local LAMP Stack using Docker

A repository containing the Docker files to build a LAMP stack which I use for local development on macOS.

This is based on a workshop given by Dana Luther. From that I have written a tutorial for installing Apache, MySQL, and PHP on macOS using Docker.

If you're just getting started with Docker, I recommend following the tutorial. Otherwise, if you are a welcome to review the notes below.

Install Docker Desktop

While I use this for development on macOS, you may use this for any platform. To being, install the Docker Desktop Client.

Images used:

  • php:8.1-apache
  • mysql:latest
  • composer:2
  • phpmyadmin/phpmyadmin:latest

To pre-download the underlying images, use the docker pull command:

docker pull php:8.1-apache
docker pull mysql:latest
docker pull composer:2

Rebuild custom PHP image

docker image build --no-cache -f images/Dockerfile-php-apache -t lamp .

Start the stack

docker stack deploy -c docker-compose.yml dev

Stop the stack

docker stack rm dev

Create named volumes

docker volume create workspace --opt type=none --opt device=/Users/jasonmccreary/workspace --opt o=bind
docker volume create data --opt type=none --opt device=/Users/jasonmccreary/data --opt o=bind

Granting the dbuser access

Since the MySQL data directory is configured to persist, this only needs to be run once per initial setup.

GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'%';

Note: This user has access from any IP to avoid additional network configuration.