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.
While I use this for development on macOS, you may use this for any platform. To being, install the Docker Desktop Client.
- 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
docker image build --no-cache -f images/Dockerfile-php-apache -t lamp .
docker stack deploy -c docker-compose.yml dev
docker stack rm dev
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
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.