/ etc / rc *不在Docker的Ubuntu 18.04上运行。无法在启动时启动cron

问题描述 投票:0回答:1

我似乎无法说服cron(或任何其他)服务从我的Ubuntu容器开始。我确定我缺少一些简单的东西。

[我尝试同时使用update-rc.d/etc/rc.local,但没有乐趣。

在此示例中,Dockerfile我还试图运行rsyslog进行调试,但结果相同-服务无法启动。

# syntax = docker/dockerfile:experimental

FROM ubuntu:18.04


RUN apt-get update && apt-get install --reinstall -y \
    rsyslog

# fix for https://stackoverflow.com/questions/56609182/openthread-environment-docker-rsyslogd-imklog-cannot-open-kernel-log-proc-km
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf

# run at startup
RUN update-rc.d rsyslog defaults

# ...really run at startup
RUN echo "service rsyslog start" >> /etc/rc.local

RUN apt-get update && apt-get install -y \
    cron

# run at startup
RUN update-rc.d cron defaults

# ...really run at startup
RUN echo "service cron start" >> /etc/rc.local

ENTRYPOINT ["/bin/bash"]

当我运行容器时:

root@e392a9404e0f:/# service --status-all
 [ - ]  cron
 [ ? ]  hwclock.sh
 [ - ]  procps
 [ - ]  rsyslog
root@e392a9404e0f:/# service cron start
 * Starting periodic command scheduler cron                                                                             [ OK ] 
root@e392a9404e0f:/# service --status-all
 [ + ]  cron
 [ ? ]  hwclock.sh
 [ - ]  procps
 [ - ]  rsyslog
docker ubuntu init.d
1个回答
0
投票
ENTRYPOINT ["/bin/bash"]

作者

ENTRYPOINT ["/sbin/init"]

作为初始化,程序负责系统初始化。进一步了解init here

© www.soinside.com 2019 - 2024. All rights reserved.