I started use Docker containers for development but my challenge was to see the code changes in the Docer container when I was using WSL Ubuntu. I was using Docker Inside the WSL Ubuntu. I was running into problems because I had to rebuild to see my changes and that was not practical.
The purpose of this page is to show you to create a PHP app in a Docker container where you can refresh the page and reload after you have edited and changed the application code.
Source:
/mnt/f/apachefriends/xampp/htdocs/PHP/docker-azure/php-simple
F:\apachefriends\xampp\htdocs\PHP\docker-azure\php-simple
Finally I found the solution from this video and follow these steps:
Start a wsl terminal and cd into:
cd /mnt/f/apachefriends/xampp/htdocs/PHP/docker-azure/php-simple
$ docker build -t my-php-app .
$ docker run -d -p 80:80 --name php-app-webserver-2 -v /mnt/f/apachefriends/xampp/htdocs/PHP/docker-azure/php-simple:/var/www/html php:8.1-apache
Note the -v flag. This option is for volume - More information here about Volumes
http://localhost
Refrences: