【问题标题】:System has not been booted with systemd as init system (PID 1). Can't operate. While trying to run apache2 within docker container系统尚未使用 systemd 作为 init system (PID 1) 引导。不能操作。尝试在 docker 容器中运行 apache2
【发布时间】:2021-04-16 08:14:45
【问题描述】:

我是 Docker 新手,我正在尝试使用 docker。

我做的步骤。

  1. 拉取 ubuntu18.04 映像并以交互方式运行。
  2. 在其中安装了 apache2。

现在,当我尝试运行 apache 时,出现以下错误。 作者:

sudo systemctl start apche2

错误:

System has not been booted with systemd as init system (PID 1). Can't operate.

之前我遇到了一个错误

systemctl command not found ubuntu

我运行了一个命令

sudo apt-get install --reinstall systems .

谁能帮我解决这个问题?

【问题讨论】:

  • 投票结束作为离题 - 请检查help centerapache标签描述。这不是开发/编程问题,而是关于运行软件的问题。

标签: docker apache ubuntu docker-container


【解决方案1】:

使用systemctl,您正试图让systemd 为您运行一个守护进程。这通常不适用于 Docker,因为它不是 Docker 应该工作的方式。 Docker 通常用于创建只要进程存在就存在的单进程容器。那就是Docker运行Apache2的方式会在前台运行:apache2 -DFOREGROUND.

【讨论】:

    猜你喜欢
    • 2019-02-11
    • 1970-01-01
    • 2021-04-12
    • 2019-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-15
    • 1970-01-01
    相关资源
    最近更新 更多