Manual Docker only — create code yourself, then build & run
This is the only way documented for this project.
You will:
- Create folders and every source file yourself (PHP or Node)
- Paste code from the linked files (or from the blocks below)
- Write a Dockerfile piece by piece
docker pullimagesdocker network createdocker volume create(named volumes only — no host folder bind mounts)docker build(code goes into the image withCOPY)docker runMySQL + app
You create .env + docker-compose.yml before running. Use manual docker run or docker compose up. There is no “mount ./application from the host”. Code is copied into the image at build time. Named volumes only hold MySQL data and uploaded files.
How code gets into the container
You create files on your PC
↓
Dockerfile: COPY application/ ...
↓
docker build → files baked into YOUR image
↓
docker run → container runs that image
Uploads / MySQL data use named volumes (created with docker volume create), not Windows folder mounts.
One-time: Docker in WSL
sudo service docker start
docker --version
If Docker is not installed yet, follow the install section in GUIDE.md (WSL + Docker Engine only).
Pick one stack
| Stack | Working folder you will create | Browser | MySQL port |
|---|---|---|---|
| PHP | ~/docker-task-php (or any empty folder) | http://localhost:8080 | 3306 |
| Node | ~/assignment-docker-node | http://localhost:3000 | 3307 |
Reference copies of the finished code already live under:
- PHP:
php-app/application/ - Node:
nodejs-app/application/(server.js+public/style.css),nodejs-app/database.sql
Open those links in your editor if you prefer copy-from-file instead of paste-from-guide.
Manual Docker only — create code yourself, then build & run
This is the only way documented for this project.
You will:
- Create folders and every source file yourself (PHP or Node)
- Paste code from the linked files (or from the blocks below)
- Write a Dockerfile piece by piece
docker pullimagesdocker network createdocker volume create(named volumes only — no host folder bind mounts)docker build(code goes into the image withCOPY)docker runMySQL + app
You create .env + docker-compose.yml before running. Use manual docker run or docker compose up. There is no “mount ./application from the host”. Code is copied into the image at build time. Named volumes only hold MySQL data and uploaded files.
How code gets into the container
You create files on your PC
↓
Dockerfile: COPY application/ ...
↓
docker build → files baked into YOUR image
↓
docker run → container runs that image
Uploads / MySQL data use named volumes (created with docker volume create), not Windows folder mounts.
One-time: Docker in WSL
sudo service docker start
docker --version
If Docker is not installed yet, follow the install section in GUIDE.md (WSL + Docker Engine only).
Pick one stack
| Stack | Working folder you will create | Browser | MySQL port |
|---|---|---|---|
| PHP | ~/docker-task-php (or any empty folder) | http://localhost:8080 | 3306 |
| Node | ~/assignment-docker-node | http://localhost:3000 | 3307 |
Reference copies of the finished code already live under:
- PHP:
php-app/application/ - Node:
nodejs-app/application/(server.js+public/style.css),nodejs-app/database.sql
Open those links in your editor if you prefer copy-from-file instead of paste-from-guide.
Go straight to: PHP manual → · Node.js manual →
Linked source files (quick index)
PHP — create these yourself
| You create | Open / copy from |
|---|---|
application/db.php | php-app/application/db.php |
application/style.css | php-app/application/style.css |
application/favorites.js | php-app/application/favorites.js |
application/index.php | php-app/application/index.php |
application/create.php | php-app/application/create.php |
application/edit.php | php-app/application/edit.php |
application/delete.php | php-app/application/delete.php |
application/favorites.php | php-app/application/favorites.php |
Dockerfile | php-app/Dockerfile |
Node — create these yourself
| You create | Open / copy from |
|---|---|
package.json | nodejs-app/package.json |
application/server.js | nodejs-app/application/server.js |
application/public/style.css | nodejs-app/application/public/style.css |
Dockerfile | nodejs-app/Dockerfile (manual version above uses npm install) |
Database SQL
| Task | File |
|---|---|
| Create DB / user / table | setup-database.html · setup.sql |
| Node init script (Compose auto-runs on a fresh MySQL volume) | nodejs-app/database.sql |
What you prove for the assignment
| Concept | How you prove it manually |
|---|---|
| Images | docker pull + docker images + your docker build image |
| Dockerfile | You wrote it; COPY puts code in the image |
| Containers | docker run / docker ps / docker rm |
| Volumes | docker volume create + -v name:/path (not host bind mount) |
| Networking | docker network create + --network-alias db + DB_HOST=db |
| Persistence | Delete containers, re-run with same volumes |
Rules for this project (summary)
| Do | Don’t |
|---|---|
Create every .php / .js file yourself | Rely on compose as the main demo |
COPY code in Dockerfile + docker build | Bind-mount source code with -v ./app:... |
docker volume create for MySQL + uploads | Only use a host ./uploads folder as the “volume story” |
docker pull then docker run | Hide everything behind one compose up |
You are building, pulling, networking, and volumizing by hand. That is the whole point.