Closed itsraghz closed 9 months ago
Hi, thank you for the report! Can you try browsing to http://localhost:41062/www ?
To be precise, -v ~/my_web_pages:/www
does not copy the files. Rather, the files become accessible for the container. If the container modifies the files, it modifies the original files -- there's no copy involved.
Hi @tomsik68 ,thank you. I see that the default index.php
page appears/renders when I access the URL http://localhost:41062/www . Just to be more precise and explicit, I have my own index.php
file inside the my_web_pages
directory (in the current directrory where I have the Dockerfile
- which should be mapped under /www
directory of the Server being created. Right? It takes its own index.php
and not mine. That is my concern. However I could get into the bash
via this Command docker exec -ti myXampp bash
and edit the index.php through this command vi /opt/lampp/htdocs/www/index.php
. But this is no what I want.
Also if I want to run a full fledged web application, should I do an FTP from my localhost to the /opt/lampp/htdocs/www
directory ? creating all the files manually here is also very tedious and time consuming. Hope you get my point. Ideally if I have the PHP web app inside the my_web_pages
directory, it should be mapped under the www
under the /opt/lampp/htdocs/www
as per the Dockerfile. I dont see a relevant entry in the Dockerfile
as well and hence I posted this issue here for your help.
I tried building a fresh build from the Dockerfile
using the command docker build - < Dockerfile
but it gives me the following error.
➜ xampp docker build - < Dockerfile
[+] Building 2.4s (11/12)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.20kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:buster 2.3s
=> [auth] library/debian:pull token for registry-1.docker.io 0.0s
=> CANCELED [1/7] FROM docker.io/library/debian:buster@sha256:2d356e1e22c0902f88ef65cb7159ecd5a96feb62345747edfd4324b 0.0s
=> => resolve docker.io/library/debian:buster@sha256:2d356e1e22c0902f88ef65cb7159ecd5a96feb62345747edfd4324b0d83a2923 0.0s
=> => sha256:2d356e1e22c0902f88ef65cb7159ecd5a96feb62345747edfd4324b0d83a2923 984B / 984B 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [2/7] RUN echo 'root:root' | chpasswd 0.0s
=> CACHED [3/7] RUN apt-get update --fix-missing && apt-get upgrade -y && apt-get -y install curl net-tools && 0.0s
=> CACHED [4/7] RUN curl -Lo xampp-linux-installer.run "https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5. 0.0s
=> ERROR [5/7] COPY supervisord-openssh-server.conf /etc/supervisor/conf.d/supervisord-openssh-server.conf 0.0s
=> ERROR [6/7] COPY startup.sh /startup.sh 0.0s
------
> [5/7] COPY supervisord-openssh-server.conf /etc/supervisor/conf.d/supervisord-openssh-server.conf:
------
------
> [6/7] COPY startup.sh /startup.sh:
------
failed to compute cache key: "/startup.sh" not found: not found
I do have the startup.sh
file from the github repository along side the supervisord-openssh-server.conf
file. But it is saying that the startup.sh
is not available.
I tried building the docker image with two different version of the command as follows.
docker build .
docker build -f Dockerfile .
Luckily it had proceeded further but gave a different error as follows.
➜ xampp docker build -f Dockerfile .
[+] Building 281.3s (8/11)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:buster 1.1s
=> [1/7] FROM docker.io/library/debian:buster@sha256:2d356e1e22c0902f88ef65cb7159ecd5a96feb62345747edfd4324b0d83a2923 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 173B 0.0s
=> CACHED [2/7] RUN echo 'root:root' | chpasswd 0.0s
=> CACHED [3/7] RUN apt-get update --fix-missing && apt-get upgrade -y && apt-get -y install curl net-tools && 0.0s
=> ERROR [4/7] RUN curl -Lo xampp-linux-installer.run "https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5 280.1s
------
> [4/7] RUN curl -Lo xampp-linux-installer.run "https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.14/xampp-linux-x64-5.6.14-4-installer.run?from_af=true" && chmod +x xampp-linux-installer.run && bash -c './xampp-linux-installer.run' && ln -sf /opt/lampp/lampp /usr/bin/lampp && sed -i.bak s'/Require local/Require all granted/g' /opt/lampp/etc/extra/httpd-xampp.conf && mkdir /opt/lampp/apache2/conf.d && echo "IncludeOptional /opt/lampp/apache2/conf.d/*.conf" >> /opt/lampp/etc/httpd.conf && mkdir /www && ln -s /www /opt/lampp/htdocs && mkdir -p /var/run/sshd && sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config:
#7 0.298 % Total % Received % Xferd Average Speed Time Time Time Current
#7 0.298 Dload Upload Total Spent Left Speed
100 816 0 816 0 0 133 0 --:--:-- 0:00:06 --:--:-- 169
100 806 0 806 0 0 112 0 --:--:-- 0:00:07 --:--:-- 24424
100 1039 0 1039 0 0 139 0 --:--:-- 0:00:07 --:--:-- 1014k
100 413 100 413 0 0 47 0 0:00:08 0:00:08 --:--:-- 1240
100 129M 100 129M 0 0 472k 0 0:04:39 0:04:39 --:--:-- 593k
------
executor failed running [/bin/sh -c curl -Lo xampp-linux-installer.run "https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.14/xampp-linux-x64-5.6.14-4-installer.run?from_af=true" && chmod +x xampp-linux-installer.run && bash -c './xampp-linux-installer.run' && ln -sf /opt/lampp/lampp /usr/bin/lampp && sed -i.bak s'/Require local/Require all granted/g' /opt/lampp/etc/extra/httpd-xampp.conf && mkdir /opt/lampp/apache2/conf.d && echo "IncludeOptional /opt/lampp/apache2/conf.d/*.conf" >> /opt/lampp/etc/httpd.conf && mkdir /www && ln -s /www /opt/lampp/htdocs && mkdir -p /var/run/sshd && sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config]: exit code: 127
Also if I want to run a full fledged web application, should I do an FTP from my localhost to the /opt/lampp/htdocs/www directory ? creating all the files manually here is also very tedious and time consuming. Hope you get my point. Ideally if I have the PHP web app inside the my_web_pages directory, it should be mapped under the www under the /opt/lampp/htdocs/www as per the Dockerfile. I dont see a relevant entry in the Dockerfile as well and hence I posted this issue here for your help.
I agree with your point and Docker allows you to run your webpage without having to copy files to the container. It should suffice to mount the directory with your php files -- ~/my_web_pages
in my examples.
If the command you used to start the container has the -v
flag, your php files should already be available in the container. If not, you might need to change preferences for your folder sharing in Docker for Mac: https://docs.docker.com/desktop/settings/mac/#file-sharing
Also, I regret to inform you that building your own image of docker-xampp won't help you resolve this.
Hey, thanks.Let me try the option you suggested of using -v
flag, and also by exploring the docker setup for the file sharing in Mac.
We just hit a one year anniversary after opening :tada: I'm closing this for inactivity for now. I'd appreciate if you shared your solution if you ever solved this. Feel free to reopen the ticket if you have more questions.
Bug Report
I'm running Docker on: Mac OS - Ventura 13.1
XAMPP start command
I used the following command to start the xampp container:
Additional steps to trigger the bug
After starting the container, I did the following:
Expected behavior
I had a sample file named
index.php
file. The index.php file (what was present in my source directory) should be rendered.Actual behavior
Web browser shows a blank page.
The reason being, the source files are NOT Copied, and the portion of the script
-v ~/my_web_pages:/www
does not do its work as expected.