Docker LAMP
Mar, 2023
Install Docker
apt install docker docker-compose apt-utils
docker --version
docker run hello-world
Create a folder on desktop
cd ~/Desktop
mkdir docker-app
cd docker-app
Manage Docker as a non-root user otherwise you have to use sudo
# 1. Create the docker group.
$ sudo groupadd docker
# 2. Add your user to the docker group.
$ sudo usermod -aG docker $USER
# 3. Log out and log back in so that your group membership is re-evaluated.
# 4. Verify that you can run docker commands without sudo.
$ docker run hello-world
Now:
git clone https://github.com/sprintcube/docker-compose-lamp.git
cd docker-compose-lamp
cp sample.env .env
// modify sample.env as needed
docker-compose up -d
// visit localhost
Now Wait!
Restart apache service:
sudo systemctl restart apache2.service
Edit .env file and change ports (I set apache port to 8000. Goto:
localhost:8000
You should be greeted with the LAMP STACK page.
Create a test.php file inside the www folder within the docker-compose-lamp directory with sample text and echo statement.
localhost:8000/test.php
If you rename or move sirectory just cd to that and run:
docker-compose up -d
Note: the hostname to connect to MySql is database
Comments
Post a Comment