A basic LAMP stack environment built using Docker Compose. It consists of the following:
- PHP
- Apache
- MySQL
- Mariadb
- Redis
Build and Run the Containers
git clone https://github.com/w3labkr/docker-lamp-stack.git docker
cd docker
cp .env.example .env
docker compose up -dRegister crontab and rebuild services
$ cp docker-entrypoint.sh bin/<PHP_VERSION>/docker-entrypoint.sh
$ docker compose up -d --buildCreate and start containers
-d: Detached mode: Run containers in the background
docker compose up -dBuild or rebuild services
docker compose up --buildStop and remove containers, networks
docker compose downRestart service containers
docker compose restart apache2Execute a command in a running container
docker compose exec apache2 bash
exitExecute a command in a running container
docker compose exec mariadb bash
mysql -uroot -psecret
show databases;
select Host, User from mysql.user;
exitForce-remove a running container (--force)
docker container rm -f $(docker container ls -aq)Remove one or more images
-f: Filter output based on conditions provided-q: Only show image IDs
docker image rm -f $(docker image ls -q)Do not use cache when building the image
docker compose build --no-cacheRemove unused data
docker system prune -a