- Build a docker image with (Linux, Apache2, MySQL, PHP).
- Run the image to create a container.
- Setup the web files and database.
- Interact with web software on your browser.
OR
- Pull and Run the image from docker HUB.
OR
- Run the whole steps in one click
Step 1: Clone the necessary files
Note: /tmp/DockerLamp -> working folder
> git clone https://github.com/nevishs/DockerLamp.git /tmp/DockerLamp
> cd /tmp/DockerLamp
Step 2: Build the image
Note: lamp-server -> repo name
> docker build -t lamp-server .
Step 3: Create the container
Note: eb7afe2ea395 -> image id, lamp-server -> repo name, /tmp/DockerLamp/www -> web files
> docker run --name eb7afe2ea395 -d -p 80:80 -p3306:3306 -v /tmp/DockerLamp/www:/var/www lamp-server
Step 4: Setup the database
Note: install.php will import our db
> http://127.0.0.1/install.php
OR
> curl http://127.0.0.1/install.php //on your docker machine
Step 5: Interact with the site
Note: test out the functionality
> http://127.0.0.1/public/
Step 1: Prepare the files
Note: /tmp/DockerLamp -> working folder
> git clone https://github.com/nevishs/DockerLamp.git /tmp/DockerLamp
> cd /tmp/DockerLamp
Step 2: Pull and Run the image
Note: nevishs/lamp-server -> repo name, 83962226cfc5 -> image id
> docker pull nevishs/lamp-server
> docker run --name 83962226cfc5 -d -p 80:80 -p3306:3306 -v /tmp/DockerLamp/www:/var/www nevishs/lamp-server
> http://127.0.0.1/install.php
> http://127.0.0.1/public/
Step 1: Get and Run the script
Note: runDockerLamp.sh -> scirpt name
> wget https://github.com/nevishs/DockerLamp/blob/master/scripts/runDockerLamp.sh
> chmod 755 runDockerLamp.sh
> ./runDockerLamp.sh
Step 2: Check the site
> http://127.0.0.1/public/
> docker image ls //lists all the images, this command is useful to find the repo name and image id
> docker container ps -a //lists all the containers
> docker stop CONTAINERID //stops the container
> docker rm CONTAINERID //destroys the container