This repository provides a Docker environment for web development designed for use in web development classes at the Upper Austria University of Applied Sciences (FH Oberösterreich), Hagenberg Campus.
This collection of Dockerfiles is based on the official Docker images for PHP 8.3, MariaDB 11.2, and phpMyAdmin 5.2, as well as additional configuration and scripts.
Do you need to familiarize yourself with Docker containers, or are you wondering why you should use them? Have a look at the Introduction first.
To use this environment, you will need to install a few tools. Some, like Docker Desktop, are mandatory, and others are recommended.
Docker Desktop creates and runs the fhooe-web-dock containers. Download and install it for Windows, Mac OS (M1 or Intel) or Linux.
- Windows: Installation Instructions + Installer Download | Chocolatey:
choco install docker-desktop
| winget:winget install -e --id Docker.DockerDesktop
- Mac OS X: Installation Instruction + Installer Download | Homebrew:
brew install --cask docker
- Linux: Installation Instructions + Package Download
To avoid rate limit issues when downloading the underlying images from Docker Hub, please register for a free account and make sure you're logged in on Docker Desktop with it.
Installing Git on your host machine is also recommended so you can easily update to the latest version of fhooe-web-dock.
-
Windows: Installer Download | Chocolatey:
choco install git
| winget:winget install -e --id Git.Git
-
Mac OS X: Xcode Commandline Tools:
xcode-select –install
| Homebrew:brew install git
-
Linux: Debian/Ubuntu:
apt-get install git
Use a command prompt such as Windows PowerShell or Terminal to enter the Docker commands. All commands must be entered in your local fhooe-web-dock directory.
docker compose up -d
This will create three containers:
webapp
: Apache web server with PHP functionality.mariadb
: MariaDB database.pma
: phpMyAdmin for database management.
docker compose stop
docker compose start
Should your containers malfunction or you want to rebuild them from the latest official images (due to new versions), you can use the provided CleanInstall
script.
- Windows: Double-click
CleanReinstall.bat
or run the command in a PowerShell/command prompt. - Mac OS X/Linux: Run
./CleanReinstall.sh
from a terminal/shell. If the file is not executable, runchmod +x CleanReinstall.sh
first.
- Stop all running fhooe-web-dock containers (
docker compose down -v
). - Remove all unused images, containers, networks, and volumes (
docker system prune --volumes -a -f
). This will also affect other Docker environments on your system! - Update fhooe-web-dock from GitHub (
git pull
). - Create and start the containers again (
docker compose up -d
).
You'll notice a subdirectory called webapp
in your fhooe-web-dock directory. This directory is mapped to /var/www/html
in the webapp
container. Since this is Apache's document root, all files and projects you put in there will be directly available on the web server. The directory initially contains the dashboard (index.php
and directory /dashboard
) and a README.md
.
You can access the web server via HTTP or HTTPS. Be advised the HTTPS certificate is self-signed and will trigger a warning in your browser.
- Web server: http://localhost:8080 (HTTP), https://localhost:7443 (HTTPS). This will show you the dashboard.
- phpMyAdmin: http://localhost:8082 (HTTP), https://localhost:8443 (HTTPS)
To access the database, you must differentiate between access from your host system (external) or one of the other containers (internal).
- External (e.g., connecting to the database from your IDE while developing): Host:
localhost
, port:6033
- Internal (e.g., connecting to the database from your web application): Host:
db
, port:3306
For shell access to your containers (in this case, the webapp
container), use the following command:
docker exec -it webapp /bin/bash
To access the other containers, replace the container name webapp
with mariadb
(database) or pma
(phpMyAdmin).
webapp
is a so-called bind mount that allows mapping a directory from the host system into the Docker container. On Linux/macOS hosts, permissions are synced. If your local user can access the directory, so does everything within the container. Permissions cannot be synced on Windows hosts, so permission errors in the container will likely occur at some point. Even though you can create files and directories within the webapp
directory, the web server in the container will not be able to write files or create directories. If this is the case, you need to set permissions manually:
chmod -R 777 your/directory/within/webapp
Be advised that 777 permissions (read/write/execute for everyone) should never be used on production systems (which fhooe-web-dock isn't per definition).
Do you need help with fhooe-web-dock? Check the wiki for known solutions or open an issue.
Thank you for starting this project Martin. You will always be remembered.