Which fails to mention that it describes Docker Desktop and not Docker Engine it is not just isolating a process in a container so the process has no knowledge about the host OS, but the host OS can’t see anything without entering the container as everything runs in a virtual machine.
The HTML is in the container and you will not be able to edit it from the host and you don’t have to. That is just a demo container and you can delete it any time.
Trying to understand better Docker, & for the fun of it, how can I modify the ‘welcome-to-docker’ default page from my IDE, VS Code?
Also, when I run ’ docker init ’ I am presented with several setup options, like to setup Apache + PHP. Do you know why there isn’t an option to setup NGINX + PHP?
Docker containers are not for editing files in them from an IDE manually. You would need a Dockerfile which I write about in my tutorial too. Without understanding what a container, you will do things that you shouldn’t. If that helps, you can still browse the container’s filesystem from Docker Desktop. Go to the Containers tab and click on the three dots in the line of the containr and choose “View files”
I wouldn’t edit the files that way, because once I tried to change a config file for debugging reason (not in production) and it changed the file permissions, so the application couldn’t read it.
You can use vscode’s remote development feature and connect to a container. HEre is the index html in the welcome-to-docker container:
/usr/share/nginx/html/index.html
my screenshots showed the httpd container.
PHP is traditionally used with Apache HTTPD as HTTPD also supports PHP as a module. You can configure nginx with a PHP container if you want to but I guess the init command creates examples for more frequently used solutions. At least for now.
Nginx is listening on port 80. The port numbe ron the right side must be 80. I shared my tutorial for a reason, since you could have learn it from that
That example uses httpd, not nginx, but the point is that you always need a container port and the host port. If those were the same, you wouldn’t need to set it twice.