Heroku和XAMPP无法启动,因为需要root权限。

huangapple go评论62阅读模式
英文:

Heroku xampp is unable to be started due to root requirement

问题

我有以下的Dockerfile推送到Heroku:

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 && \
  # Enable error display in php
  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

CMD ["./opt/lampp/lampp", "start"]

我的问题是,我收到一个错误,需要root权限才能启动xampp,我不知道如何配置CMD以root身份运行。

2023-06-22T10:52:47.278663+00:00 heroku[web.1]: Starting process with command `./opt/lampp/lampp start`
2023-06-22T10:52:48.271574+00:00 heroku[web.1]: Process exited with status 2
2023-06-22T10:52:48.142173+00:00 app[web.1]: Starting XAMPP for Linux 8.1.0-0...
2023-06-22T10:52:48.147100+00:00 app[web.1]: You need to be root to perform this action.

有人知道我如何解决这个问题吗?例如,更改权限以使xampp无需root权限运行?

如果我设置xampp在启动时启动并删除CMD,Heroku会以/bin/bash启动,然后崩溃:

2023-06-22T12:52:54.454322+00:00 heroku[web.1]: Starting process with command `/bin/bash`
2023-06-22T12:52:55.315574+00:00 heroku[web.1]: Process exited with status 0
2023-06-22T12:52:55.349266+00:00 heroku[web.1]: State changed from starting to crashed
英文:

I have the following Dockerfile pushed to Heroku:

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 && \
  # Enable error display in php
  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



CMD ["./opt/lampp/lampp", "start"]

My problem is that I get an error that for the starting of xampp root is needed and I have no idea how to configure a CMD to run as root.

2023-06-22T10:52:47.278663+00:00 heroku[web.1]: Starting process with command `./opt/lampp/lampp start`
2023-06-22T10:52:48.271574+00:00 heroku[web.1]: Process exited with status 2
2023-06-22T10:52:48.142173+00:00 app[web.1]: Starting XAMPP for Linux 8.1.0-0...
2023-06-22T10:52:48.147100+00:00 app[web.1]: You need to be root to perform this action.

Does anyone know how I can support this problem? For example, change the permissions so xampp can be run without requiring root?

If I set xampp to start on bootup and remove the CMD heroku starts with /bin/bash and then crashes:

2023-06-22T12:52:54.454322+00:00 heroku[web.1]: Starting process with command `/bin/bash`
2023-06-22T12:52:55.315574+00:00 heroku[web.1]: Process exited with status 0
2023-06-22T12:52:55.349266+00:00 heroku[web.1]: State changed from starting to crashed

答案1

得分: 0

由于安全原因,发现Docker容器没有root权限。因此,我正在寻找替代方法,但以root身份执行不是一个选项。

https://devcenter.heroku.com/articles/container-registry-and-runtime#testing-an-image-locally

英文:

It turns out that for security reasons the dockers do not have root permission. So I am in search of an alternative way but executing as root is not an option.

https://devcenter.heroku.com/articles/container-registry-and-runtime#testing-an-image-locally

huangapple
  • 本文由 发表于 2023年6月22日 18:58:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76531201.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定