【问题标题】:No output running /usr/sbin/crond in a Docker alpine container?在 Docker 高山容器中没有运行 /usr/sbin/crond 的输出?
【发布时间】:2020-02-26 09:05:43
【问题描述】:

我的简单Dockerfile 似乎有效,但我很确定我做错了什么。 容器日志为空 (docker logs -f <container id>)。

crond 命令在前台运行 (-f),为什么我看不到任何输出?

FROM alpine

RUN apk add --update --no-cache lftp mariadb-client

CMD ["/usr/sbin/crond", "-l", "2", "-f"]

【问题讨论】:

    标签: docker cron


    【解决方案1】:

    这对我有用。

    你的 Dockerfile。

    docker build --tag=60404556 --file=Dockerfile .
    
    # One terminal
    docker run --rm --interactive --tty --name=crond 60404556
    crond[1]: crond (busybox 1.31.1) started, log level 2
    crond[1]: user:root entry:*/15  *   *   *   *   run-parts /etc/periodic/15min
    crond[1]: user:root entry:0 *   *   *   *   run-parts /etc/periodic/hourly
    crond[1]: user:root entry:0 2   *   *   *   run-parts /etc/periodic/daily
    crond[1]: user:root entry:0 3   *   *   6   run-parts /etc/periodic/weekly
    crond[1]: user:root entry:0 5   1   *   *   run-parts /etc/periodic/monthly
    ...
    
    # Another term
    docker container logs --follow crond
    crond[1]: crond (busybox 1.31.1) started, log level 2
    crond[1]: user:root entry:*/15  *   *   *   *   run-parts /etc/periodic/15min
    crond[1]: user:root entry:0 *   *   *   *   run-parts /etc/periodic/hourly
    crond[1]: user:root entry:0 2   *   *   *   run-parts /etc/periodic/daily
    crond[1]: user:root entry:0 3   *   *   6   run-parts /etc/periodic/weekly
    crond[1]: user:root entry:0 5   1   *   *   run-parts /etc/periodic/monthly
    ...
    

    【讨论】:

    • 您正在从 crond 获取输出?
    猜你喜欢
    • 1970-01-01
    • 2019-06-03
    • 2023-03-05
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    • 2021-08-08
    • 2022-01-14
    相关资源
    最近更新 更多