You can nudge your life in a new direction every day.

Docker: Editing an HTML page from my local machine

Submitted by admin on Sat, 11/07/2020 - 17:16

With docker I can 

 

docker run -v /path/to/directory:/usr/local/apache2/htdocs/ --name my-apache-app -p 80:80  httpd:2.4

So what's happening here?

Your container is running Apache2 and serving files from /usr/local/apache2/htdocs/ 

We can map our project's directory on our local machine to this directory on the container's file system. They will effectively mirror one another.


If you know your shell and want to skip adding the absolute directly you can get clever with a PWD variable.
For example in Powershell you can substitute the absolute path with a variable like this.

docker run -v "${pwd}":/usr/local/apache2/htdocs/ --name my-apache-app -p 80:80  httpd:2.4