Skip to content

Instantly share code, notes, and snippets.

@tarikwaleed
Created March 30, 2023 05:16
Show Gist options
  • Save tarikwaleed/7c860ff7930f951b8331bc0731a64538 to your computer and use it in GitHub Desktop.
Save tarikwaleed/7c860ff7930f951b8331bc0731a64538 to your computer and use it in GitHub Desktop.
An easy to follow tutorial on how to dockerize PHP Course Lecture demos by Dr. Noha Hesham

Docker Setup

First, Make sure that Docker is installed on your machine by running the following command

docker -v

If you havn't install docker already - but i'm sure you did from the docker course days- the docker documentation provides an easy to follow steps to set up docker on your local machine.

For ubuntu users , here you'll find instructions to install it on your machine. Follow this guide

The installation method i personally prefer is Here

If you are using windows, as Dr. Noha always saying .. God bless your soul 😂 . you can install Docker Desktop from here Docker Desktop Installation

Steps

  1. Clone the demo repo, or the repo of your intake track
git clone https://github.com/NohaAShehab/os43-assuit-php.git
  1. cd into the directory
cd os43-assuit-php
  1. Inside the project directory, create a new file named Dockerfile.
touch Dockerfile
  1. open this file using your favourite text editor, i'm using vim but you can use VsCode or anything else.
vim Dockerfile
  1. paste the following two lines in the file
FROM php:7.4-apache
COPY . /var/www/html/
  1. Next, build the Docker image by running the following command from the project directory:
docker build -t php-day2-demos .
  1. Once the image is built, you can start a container from it by running the following command:
docker run -p 8080:80 php-day2-demos

and that's it! You can now access Day2 Demo application by visiting http://localhost:8080/validation/userstable.php in your web browser

@Salama-Malek
Copy link

Very impressive, dear Tarik. I liked the way you wrote the steps. They are straightforward to follow.
I want to thank you for your efforts, this will help us a lot while working on the PHP course and further projects.
Well done, Eng.Tarik.

@tarikwaleed
Copy link
Author

i'm glad that this helped ,thank you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment