0

I installed xampp inside a docker using the standard xampp installer and wrote a startup script that I set as the CMD that starts xampp. My problem is that to start xampp root is required. And on heroku where I intend to host this docker, the instances are run without root access. Is there a way to avoid this problem, set the permission differently or create it in a different manner?

Hers is my Dockerfile:

FROM ubuntu:bionic
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update --fix-missing && \
  apt-get upgrade -y && \
  apt-get -y install iputils-ping && \
  apt-get -y install net-tools && \
  apt-get clean

COPY xampp-linux-x64-8.1.0-0-installer.run /opt/xampp-linux-x64-8.1.0-0-installer.run

RUN chmod +x /opt/xampp-linux-x64-8.1.0-0-installer.run && \
  bash -c ./opt/xampp-linux-x64-8.1.0-0-installer.run && \
  sed -i.bak s'/Require local/Require all granted/g' /opt/lampp/etc/extra/httpd-xampp.conf && \
#  sed -i.bak s'/Listen 80/Listen ${PORT}/g' /opt/lampp/etc/httpd.conf && \
  sed -i.bak s'/display_errors=Off/display_errors=On/g' /opt/lampp/etc/php.ini && \
  sed -i.bak s'/post_max_size=40M/post_max_size=100M/g' /opt/lampp/etc/php.ini

COPY startup.sh /startup.sh

RUN useradd -m xamppuser
USER xamppuser

And here is the startup.sh script:

/opt/lampp/lampp start
while :
do  
    sleep 2m
    /opt/lampp/lampp status
done

Thanks for helping out

1
  • xampp stands for Cross-Platform, Apache, MySQL, PHP, and Perl. With Docker you no longer need the cross-platform part, instead go directly with Apache + PHP if you know Apache already. If you don't know Apache, skip it and go with NGINX or Caddy. Here is a good write up on the latter - colada.be/caddy-php-and-docker.html. As for DB use something that will persist your docker restarts - devcenter.heroku.com/articles/cleardb. This does not answer the question that's why I am leaving this as comment only. Good luck! :)
    – Kyslik
    Jul 8 at 19:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.